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

排产计划维护

parent a2a7b819
......@@ -9,38 +9,58 @@
<input type="hidden" name="djly" value="M" >
<input type="hidden" name="sysversion">
<div class="gui-row" >
<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="djid" data-toggle="gui-textbox" data-options="" >
</div>
</div>
<div class="gui-col-sm4">
<label class="gui-form-label">计划日期:</label>
<div class="gui-col-sm3">
<label class="gui-form-label">选择时间:</label>
<div class="gui-input-block">
<input type="text" name="xzny" >
</div>
</div>
<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="jhrq" data-toggle="gui-datebox" data-options="required:true" >
<input type="text" name="ksrq" data-toggle="gui-datebox" data-options="required:true,disabled:true" >
</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="jsrq" 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="bmid" data-toggle="gui-textbox" data-options="" >
</div>
</div>
<div class="gui-col-sm3">
<label class="gui-form-label">计划人:</label>
<div class="gui-input-block">
<input type="text" name="jhr" data-toggle="gui-textbox" data-options="" >
</div>
</div>
<div class="gui-col-sm12">
<label class="gui-form-label">备注:</label>
<div class="gui-input-block">
<input type="text" name="bz" data-toggle="gui-textbox" data-options="" >
</div>
</div>
</div>
<div class="gui-row" >
<div class="gui-col-sm4">
<label class="gui-form-label">计划人:</label>
<div class="gui-input-block">
<input type="text" name="jhr" data-toggle="gui-textbox" data-options="" >
</div>
</div>
<div class="gui-col-sm8">
<label class="gui-form-label">备注:</label>
<div class="gui-input-block">
<input type="text" name="bz" data-toggle="gui-textbox" data-options="" >
</div>
</div>
</div>
</div>
<div class="mx-dataTable" style="margin-top: 150px;bottom: 40px">
......@@ -75,7 +95,8 @@
$(function () {
var $div=$('#woPcjhkEdit');
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 $datWhsj = $div.find('input[name="whsj"]');
var $edtWhr = $div.find('input[name="whr"]');
......@@ -83,10 +104,11 @@
var $edtId = $div.find('input[name="id"]');
var $cbxLydjid = $div.find('input[name="woid"]');
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");
gas.load(paramInit, pageInit, dataInit, run);
function paramInit(ops){
}
......@@ -95,10 +117,14 @@
var columns = [
{title: "序号", field: "xh", fieldType: "ftString",width:70},
{title: "生产单号", field: "woDjid", fieldType: "ftString",width:120},
{title: "计划日期", field: "jhrq", fieldType: "date", editor: {
type: 'datebox', required: true
}
},
// {title: "计划日期", field: "ksrq", fieldType: "date", editor: {
// type: 'datebox', required: true
// }
// },
// {title: "结束日期", field: "jsrq", fieldType: "date", editor: {
// type: 'datebox', required: true
// }
// },
{title: "物料ID", field: "wlid", hidden:true},
{title: "物料编码", field: "wlxxCode", width: 120},
{title: "物料名称", field: "wlxxName", width: 140},
......@@ -106,7 +132,7 @@
{title: "完工数量", field: "wgsl", fieldType: "float"},
{title: "合格数量", field: "hgsl", fieldType: "float"},
{title: "不合格数量", field: "bhgsl", fieldType: "float"},
{title: "备注", field: "bz", fieldType: "ftString",width:240}
// {title: "备注", field: "bz", fieldType: "ftString",width:240}
];
$datagrid.DataTableEditing({
columns:[new $.common.formatterCol(columns)],
......@@ -114,12 +140,25 @@
allowAdd:false,
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'});
$datJhrq.datebox("bindChange",doJhrqChange);
$datksrq.datebox("bindChange",doksrqChange);
$div.find(".datagrid-header-row td[field='wlxxCode']").css("border","none");
$("#bzEditPcjhmxk-toolbar").find(".chooseWO").iMenubutton({
text:"选择生产订单",
iconCls:"fa fa-search",
......@@ -130,7 +169,7 @@
tag:'add',
onSaveCallback:function (opt,data) {
$datagrid.datagrid("loadData",[]);
var jhrq=$datJhrq.val();
var ksrq=$datksrq.val();
var list=data.list;
$cbxDjly.val('WO');
var xh=0;
......@@ -138,10 +177,10 @@
item['woid']=item['id'];
item['woDjid']=item['djid'];
item['jhsl']=item['xqsl'];
if(!jhrq){
item["jhrq"]=''
if(!ksrq){
item["ksrq"]=''
}else{
item['jhrq']=jhrq;
item['ksrq']=ksrq;
}
item['xh']=xh+1;
delete item["id"];
......@@ -160,7 +199,7 @@
gas.post("common/datetime",{},function (result) {
if(result['success']&&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)});
}
}, ops);
......@@ -181,7 +220,7 @@
}
loadListDatagrid($datagrid,{url:"kmes/pcjhk/query/detail",params:{mid:$edtId.val()}},$div.closest("form"));
}
function doCellClick(rowIndex, field, value) {
if(field=="choose"){
$datagrid.datagrid('acceptChanges');
......@@ -224,10 +263,62 @@
})
}
}
function doJhrqChange(value) {
/* 获取几天前的时间 */
function getBeforeDate(n,e) {
const sum=86400
let datesjc=e.valueOf()+""
datesjc=parseInt(datesjc.substring(0,10))
return datesjc+sum*n
}
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");
if (rows.length <= 0){
return true;
......@@ -239,7 +330,7 @@
$datagrid.datagrid("updateRow",{
index:i,
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