Commit 5fe56f5d authored by 李苏's avatar 李苏 💬

排产计划维护

parent a2a7b819
...@@ -9,39 +9,59 @@ ...@@ -9,39 +9,59 @@
<input type="hidden" name="djly" value="M" > <input type="hidden" name="djly" value="M" >
<input type="hidden" name="sysversion"> <input type="hidden" name="sysversion">
<div class="gui-row" > <div class="gui-row" >
<div class="gui-col-sm4"> <div class="gui-col-sm3">
<label class="gui-form-label" >计划编码:</label> <label class="gui-form-label" >计划编码:</label>
<div class="gui-input-block"> <div class="gui-input-block">
<input type="text" name="djid" data-toggle="gui-textbox" data-options="" > <input type="text" name="djid" data-toggle="gui-textbox" data-options="" >
</div> </div>
</div> </div>
<div class="gui-col-sm4"> <div class="gui-col-sm3">
<label class="gui-form-label">计划日期</label> <label class="gui-form-label">选择时间</label>
<div class="gui-input-block"> <div class="gui-input-block">
<input type="text" name="jhrq" data-toggle="gui-datebox" data-options="required:true" > <input type="text" name="xzny" >
</div> </div>
</div> </div>
<div class="gui-col-sm4"> <div class="gui-col-sm3">
<label class="gui-form-label">周次:</label>
<div class="gui-input-block">
<input type="text" name="xzzc" data-options="disabled:true" >
</div>
</div>
<div class="gui-col-sm3">
<label class="gui-form-label">开始日期:</label>
<div class="gui-input-block">
<input type="text" name="ksrq" data-toggle="gui-datebox" data-options="required:true,disabled:true" >
</div>
</div>
<div class="gui-col-sm3">
<label class="gui-form-label">结束日期:</label>
<div class="gui-input-block">
<input type="text" name="jsrq" data-toggle="gui-datebox" data-options="required:true,disabled:true" >
</div>
</div>
<div class="gui-col-sm3">
<label class="gui-form-label">计划部门:</label> <label class="gui-form-label">计划部门:</label>
<div class="gui-input-block"> <div class="gui-input-block">
<input type="text" name="bmid" data-toggle="gui-textbox" data-options="" > <input type="text" name="bmid" data-toggle="gui-textbox" data-options="" >
</div> </div>
</div> </div>
</div> <div class="gui-col-sm3">
<div class="gui-row" >
<div class="gui-col-sm4">
<label class="gui-form-label">计划人:</label> <label class="gui-form-label">计划人:</label>
<div class="gui-input-block"> <div class="gui-input-block">
<input type="text" name="jhr" data-toggle="gui-textbox" data-options="" > <input type="text" name="jhr" data-toggle="gui-textbox" data-options="" >
</div> </div>
</div> </div>
<div class="gui-col-sm8"> <div class="gui-col-sm12">
<label class="gui-form-label">备注:</label> <label class="gui-form-label">备注:</label>
<div class="gui-input-block"> <div class="gui-input-block">
<input type="text" name="bz" data-toggle="gui-textbox" data-options="" > <input type="text" name="bz" data-toggle="gui-textbox" data-options="" >
</div> </div>
</div> </div>
</div> </div>
<div class="gui-row" >
</div>
</div> </div>
<div class="mx-dataTable" style="margin-top: 150px;bottom: 40px"> <div class="mx-dataTable" style="margin-top: 150px;bottom: 40px">
<div id="bzEditPcjhmxk-toolbar" class="gui-toolbar" data-options="grid:{type:'edatagrid',id:'bzEditPcjhmxk'}"> <div id="bzEditPcjhmxk-toolbar" class="gui-toolbar" data-options="grid:{type:'edatagrid',id:'bzEditPcjhmxk'}">
...@@ -75,7 +95,8 @@ ...@@ -75,7 +95,8 @@
$(function () { $(function () {
var $div=$('#woPcjhkEdit'); var $div=$('#woPcjhkEdit');
var $datagrid = $('#bzEditPcjhmxk'); var $datagrid = $('#bzEditPcjhmxk');
var $datJhrq = $div.find('input[name="jhrq"]'); var $datksrq = $div.find('input[name="ksrq"]');
var $datjsrq = $div.find('input[name="jsrq"]');
var $cbxBmid = $div.find('input[name="bmid"]'); var $cbxBmid = $div.find('input[name="bmid"]');
var $datWhsj = $div.find('input[name="whsj"]'); var $datWhsj = $div.find('input[name="whsj"]');
var $edtWhr = $div.find('input[name="whr"]'); var $edtWhr = $div.find('input[name="whr"]');
...@@ -83,8 +104,9 @@ ...@@ -83,8 +104,9 @@
var $edtId = $div.find('input[name="id"]'); var $edtId = $div.find('input[name="id"]');
var $cbxLydjid = $div.find('input[name="woid"]'); var $cbxLydjid = $div.find('input[name="woid"]');
var $cbxDjly = $div.find('input[name="djly"]'); var $cbxDjly = $div.find('input[name="djly"]');
var $xzny = $div.find('input[name="xzny"]');
var $xzzc = $div.find('input[name="xzzc"]');
var $tag = $div.closest('form').attr("tag"); var $tag = $div.closest('form').attr("tag");
gas.load(paramInit, pageInit, dataInit, run); gas.load(paramInit, pageInit, dataInit, run);
function paramInit(ops){ function paramInit(ops){
...@@ -95,10 +117,14 @@ ...@@ -95,10 +117,14 @@
var columns = [ var columns = [
{title: "序号", field: "xh", fieldType: "ftString",width:70}, {title: "序号", field: "xh", fieldType: "ftString",width:70},
{title: "生产单号", field: "woDjid", fieldType: "ftString",width:120}, {title: "生产单号", field: "woDjid", fieldType: "ftString",width:120},
{title: "计划日期", field: "jhrq", fieldType: "date", editor: { // {title: "计划日期", field: "ksrq", fieldType: "date", editor: {
type: 'datebox', required: true // type: 'datebox', required: true
} // }
}, // },
// {title: "结束日期", field: "jsrq", fieldType: "date", editor: {
// type: 'datebox', required: true
// }
// },
{title: "物料ID", field: "wlid", hidden:true}, {title: "物料ID", field: "wlid", hidden:true},
{title: "物料编码", field: "wlxxCode", width: 120}, {title: "物料编码", field: "wlxxCode", width: 120},
{title: "物料名称", field: "wlxxName", width: 140}, {title: "物料名称", field: "wlxxName", width: 140},
...@@ -106,7 +132,7 @@ ...@@ -106,7 +132,7 @@
{title: "完工数量", field: "wgsl", fieldType: "float"}, {title: "完工数量", field: "wgsl", fieldType: "float"},
{title: "合格数量", field: "hgsl", fieldType: "float"}, {title: "合格数量", field: "hgsl", fieldType: "float"},
{title: "不合格数量", field: "bhgsl", fieldType: "float"}, {title: "不合格数量", field: "bhgsl", fieldType: "float"},
{title: "备注", field: "bz", fieldType: "ftString",width:240} // {title: "备注", field: "bz", fieldType: "ftString",width:240}
]; ];
$datagrid.DataTableEditing({ $datagrid.DataTableEditing({
columns:[new $.common.formatterCol(columns)], columns:[new $.common.formatterCol(columns)],
...@@ -114,12 +140,25 @@ ...@@ -114,12 +140,25 @@
allowAdd:false, allowAdd:false,
onClickCell:doCellClick onClickCell:doCellClick
}); });
$xzny.iDatebox({onSelect:function(e){
let data=getfeWeek(e)
let weekday=data.weekday
let nowWeek=data.nowWeek
let weekStart=data.weekStart
let weekEnd=data.weekEnd
$xzzc.combobox('setValue',nowWeek);
$datksrq.datebox('setValue',new Date(weekStart))
$datjsrq.datebox('setValue',new Date(weekEnd))
console.log(weekEnd)
}})
$xzzc.iCombobox({valueField: 'zcv', textField: 'zc',
data:[{zcv:0,zc:""},{zcv:1,zc:"第一周"},{zcv:0,zc:"第二周"},{zcv:0,zc:"第三周"},{zcv:0,zc:"第四周"},{zcv:0,zc:"第五周"},{zcv:0,zc:"第六周"}]
}
);
$cbxBmid.iCombobox({valueField: 'id', textField: 'bmmc'}); $cbxBmid.iCombobox({valueField: 'id', textField: 'bmmc'});
$datJhrq.datebox("bindChange",doJhrqChange); $datksrq.datebox("bindChange",doksrqChange);
$div.find(".datagrid-header-row td[field='wlxxCode']").css("border","none"); $div.find(".datagrid-header-row td[field='wlxxCode']").css("border","none");
$("#bzEditPcjhmxk-toolbar").find(".chooseWO").iMenubutton({ $("#bzEditPcjhmxk-toolbar").find(".chooseWO").iMenubutton({
text:"选择生产订单", text:"选择生产订单",
iconCls:"fa fa-search", iconCls:"fa fa-search",
...@@ -130,7 +169,7 @@ ...@@ -130,7 +169,7 @@
tag:'add', tag:'add',
onSaveCallback:function (opt,data) { onSaveCallback:function (opt,data) {
$datagrid.datagrid("loadData",[]); $datagrid.datagrid("loadData",[]);
var jhrq=$datJhrq.val(); var ksrq=$datksrq.val();
var list=data.list; var list=data.list;
$cbxDjly.val('WO'); $cbxDjly.val('WO');
var xh=0; var xh=0;
...@@ -138,10 +177,10 @@ ...@@ -138,10 +177,10 @@
item['woid']=item['id']; item['woid']=item['id'];
item['woDjid']=item['djid']; item['woDjid']=item['djid'];
item['jhsl']=item['xqsl']; item['jhsl']=item['xqsl'];
if(!jhrq){ if(!ksrq){
item["jhrq"]='' item["ksrq"]=''
}else{ }else{
item['jhrq']=jhrq; item['ksrq']=ksrq;
} }
item['xh']=xh+1; item['xh']=xh+1;
delete item["id"]; delete item["id"];
...@@ -160,7 +199,7 @@ ...@@ -160,7 +199,7 @@
gas.post("common/datetime",{},function (result) { gas.post("common/datetime",{},function (result) {
if(result['success']&&result['data']['data']){ if(result['success']&&result['data']['data']){
var date = new Date(result['data']['data']); var date = new Date(result['data']['data']);
$datJhrq.iDatebox({value: DateUtils.format(date)}); $datksrq.iDatebox({value: DateUtils.format(date)});
$datWhsj.iDatetimebox({value: DateUtils.formatTime(date)}); $datWhsj.iDatetimebox({value: DateUtils.formatTime(date)});
} }
}, ops); }, ops);
...@@ -224,10 +263,62 @@ ...@@ -224,10 +263,62 @@
}) })
} }
} }
/* 获取几天前的时间 */
function getBeforeDate(n,e) {
const sum=86400
let datesjc=e.valueOf()+""
datesjc=parseInt(datesjc.substring(0,10))
return datesjc+sum*n
}
function doJhrqChange(value) { function timestampToTime(timestamp){
let date = new Date(timestamp);
  var YY = date.getFullYear() + '-';
  var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
  var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
  var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
  var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
  return YY + MM + DD ;
}
function get17(e){
var weekarry=[1,2,3,4,5,6,7]
return weekarry[e]
}
var getMonthWeek = function (a, b, c) {
/**
* a = d = 当前日期
* b = 6 - w = 当前周的还有几天过完(不算今天)
* a + b 的和在除以7 就是当天是当前月份的第几周
*/
var date = new Date(a, parseInt(b) - 1, c),
w = date.getDay(),
d = date.getDate();
if(w==0){
w=7;
}
var config={
getMonth:date.getMonth()+1,
getYear:date.getFullYear(),
getWeek:Math.ceil((d + 6 - w) / 7),
}
return config;
};
function getfeWeek(date){
let year=date.getFullYear()
let month=date.getMonth()+1
let day=date.getDate()
let weekday=date.getUTCDay()
console.log(weekday)
weekday=get17(weekday)
let nowWeek = getMonthWeek(year,month,day).getWeek
let weekStart=getBeforeDate(-(weekday-1),date)*1000
let weekEnd=getBeforeDate((7-weekday),date)*1000
return {weekday:weekday,nowWeek:nowWeek,weekStart:weekStart,weekEnd:weekEnd}
}
function doksrqChange(value) {
let zrz=getMonthWeek(value.getFullYear(),value.getMonth()+1,value.getDate())
console.log(zrz)
var rows=$datagrid.datagrid("getRows"); var rows=$datagrid.datagrid("getRows");
if (rows.length <= 0){ if (rows.length <= 0){
return true; return true;
...@@ -239,7 +330,7 @@ ...@@ -239,7 +330,7 @@
$datagrid.datagrid("updateRow",{ $datagrid.datagrid("updateRow",{
index:i, index:i,
row:{ row:{
jhrq:value.Format("yyyy-MM-dd") ksrq:value.Format("yyyy-MM-dd")
} }
}) })
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment