20251009 排产计划

This commit is contained in:
2025-10-09 09:30:37 +08:00
parent 0ac7d74b5e
commit 87fb529521
5 changed files with 234 additions and 79 deletions
@@ -44,14 +44,14 @@
Layout="VBox" ShowHeader="false" BodyPadding="5px" IconFont="PlusCircle" Title="排产计划"
TitleToolTip="排产计划" AutoScroll="true">
<Items>
<f:Panel ID="panelCenterTop" runat="server" ShowBorder="true" RegionPosition="Center" Title="生产看板" AutoScroll="true" Layout="VBox">
<f:Panel ID="panelCenterTop" runat="server" ShowBorder="true" RegionPosition="Center" Title="生产看板" AutoScroll="true" Layout="VBox" EnableCollapse="true">
<Items>
<f:Grid ID="Grid2" ShowBorder="true" ShowHeader="false" Title="生产看板" ForceFit="false"
EnableCollapse="false" runat="server" BoxFlex="1" DataKeyNames="UnitWorkId,FlowingSection" AllowCellEditing="true"
EnableColumnLines="true" ClicksToEdit="1" DataIDField=""
AllowSorting="true" SortField="UnitWorkCode,FlowingSection" SortDirection="ASC"
AllowSorting="true" SortField="UnitWorkName,FlowingSection" SortDirection="ASC"
AllowPaging="true" IsDatabasePaging="true" PageSize="15"
EnableTextSelection="True" Height="300px">
EnableTextSelection="True" Height="300px" OnRowDataBound="Grid2_RowDataBound">
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
Width="60px" HeaderTextAlign="Center" TextAlign="Center" />
@@ -91,9 +91,9 @@
DataField="CurrentDayCompletedDia" SortField="CurrentDayCompletedDia" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="140px">
</f:RenderField>
<f:RenderField HeaderText="次日应完成量" ColumnID="NextDayComplete"
<f:RenderField HeaderText="次日应完成量(平均)" ColumnID="NextDayComplete"
DataField="NextDayComplete" SortField="NextDayComplete" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
Width="150px">
</f:RenderField>
<f:RenderField HeaderText="累计已完成量" ColumnID="totalCompletedDia"
DataField="totalCompletedDia" SortField="totalCompletedDia" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
@@ -132,11 +132,11 @@
</Items>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="True" Title="排产计划" ForceFit="false"
EnableCollapse="false" runat="server" BoxFlex="1" DataKeyNames="ProductionSchedulingPlanId" AllowCellEditing="true"
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="ProductionSchedulingPlanId" AllowCellEditing="true"
EnableColumnLines="true" ClicksToEdit="1" DataIDField="ProductionSchedulingPlanId"
AllowSorting="true" SortField="FlowNum,Material,Caliber" SortDirection="ASC" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange"
EnableTextSelection="True" OnRowDataBound="Grid1_RowDataBound">
EnableTextSelection="True" OnRowDataBound="Grid1_RowDataBound" >
<Toolbars>
<f:Toolbar ID="Toolbar3" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
@@ -210,9 +210,6 @@
<f:RenderField HeaderText="平均每日应完成工作量" ColumnID="AvgDailyWorkload"
DataField="AvgDailyWorkload" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="140px">
<Editor>
<f:NumberBox ID="txtAvgDailyWorkload" runat="server" NoNegative="true"></f:NumberBox>
</Editor>
</f:RenderField>
<f:RenderField HeaderText="当日已完成量" ColumnID="OnDayCompleteDyne"
DataField="OnDayCompleteDyne" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
@@ -221,9 +218,6 @@
<f:RenderField HeaderText="次日应完成量" ColumnID="NextDayCompleteDyne"
DataField="NextDayCompleteDyne" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left"
Width="120px">
<Editor>
<f:NumberBox ID="NumberBox2" runat="server" NoNegative="true"></f:NumberBox>
</Editor>
</f:RenderField>
<f:RenderField HeaderText="累计已完成量" ColumnID="CompletedCount"
DataField="CompletedCount" FieldType="String" HeaderTextAlign="Center" TextAlign="Left"
@@ -283,17 +277,22 @@
}
function onGridDataLoad(event) {
this.mergeColumns(['FlowNum', 'Material', 'TotalDyne', 'TotalPriority', 'PriorityTotalDyne', 'TotalCompletedRate']);
this.mergeColumns(['FlowNum', 'Material', 'TotalDyne', 'TotalPriority'], {
depends: true
});
this.mergeColumns(['FlowNum', 'PriorityTotalDyne', 'TotalCompletedRate'], {
depends: true
});
}
//自动计算天数、平均每天工作量
function onGridAfterEdit(event, value, params) {
var me = this, columnId = params.columnId, rowId = params.rowId;
if (columnId === 'PlanStartDate' || columnId === 'PlanEndDate' || columnId == 'TotalDyne' || columnId == 'OnDayCompleteDyne') {
if (columnId === 'PlanStartDate' || columnId === 'PlanEndDate' || columnId == 'Dain' || columnId == 'OnDayCompleteDyne') {
const startDate = Date.parse(me.getCellValue(rowId, 'PlanStartDate'));//计划开始时间
const endDate = Date.parse(me.getCellValue(rowId, 'PlanEndDate'));//计划结束时间
var totalDia = me.getCellValue(rowId, 'TotalDyne');//达因
var dain = me.getCellValue(rowId, 'Dain');//达因
var onDayCompleteDyne = me.getCellValue(rowId, 'OnDayCompleteDyne');//当日已完成量
var completedCount = me.getCellValue(rowId, 'CompletedCount');//累计已完成量
if (startDate > endDate) {
alert("计划开始时间不能大于计划结束时间");
@@ -303,17 +302,24 @@
const timeDifference = endDate - startDate;
// 将时间差转换为天数
const daysDifference = timeDifference / (1000 * 60 * 60 * 24);
//平均每天工作量=达因/天数
const avgDailyWorkload = totalDia / (daysDifference + 1);
//次日应完成量=平均每天完成量-已完成量+平均每天完成量
if (onDayCompleteDyne != "") {
var nextDayCompleteDyne = avgDailyWorkload - onDayCompleteDyne + avgDailyWorkload;
//平均每日应完成量=达因/天数
const avgDailyWorkload = dain / (daysDifference + 1);
const currentTime = Math.abs(endDate - Date.now());//获取剩余天数(毫秒)
const daysTime = Math.ceil(currentTime / (1000 * 60 * 60 * 24));//将时间差转换为天数
if (daysTime > 0) {
//次日应完成量=剩余工程量(达因数-累计已完成量)/剩余天数(结束时间-当前时间)
var nextDayCompleteDyne = (dain - completedCount) / daysTime;
}
me.updateCellValue(rowId, 'Days', daysDifference + 1);//天数
me.updateCellValue(rowId, 'AvgDailyWorkload', avgDailyWorkload.toFixed(2));//平均每天工作量
me.updateCellValue(rowId, 'NextDayCompleteDyne', nextDayCompleteDyne.toFixed(2));//次日应完成量
}
}
</script>
</body>