提交 170ec794 编写于 作者: W weizhiqiang

生产模块-加工单,领料单公共代码合并

上级 75a71825
......@@ -20,58 +20,56 @@ layui.config({
var $ = layui.$,
form = layui.form;
initData();
function initData(){
showGrid({
id: "showForm",
url: flowableBasePath + "erpmachin006",
params: {rowId: parent.rowId},
pagination: false,
template: $("#useTemplate").html(),
ajaxSendLoadBefore: function(hdb, json){
needNum = json.bean.needNum;
hdb.registerHelper('compare1', function(v1, v2, options) {
return (parseFloat(v1) * parseFloat(v2)).toFixed(2);
});
var loadOperatorBtn = false;
$.each(json.bean.procedure, function(i, item) {
item.unitPrice = parseFloat(item.unitPrice).toFixed(2);
if(item.state == 1){
item.stateName = "<span class='state-down'>待验收</span>";
if(!loadOperatorBtn){
loadOperatorBtn = true;
if(i == (json.bean.procedure.length - 1)){
item.operator = '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal acceptance" rowId="' + item.id + '" subType="2">生成验收单</button>';
} else {
item.operator = '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal acceptance" rowId="' + item.id + '" subType="1">工序验收</button>';
}
} else {
if(i == (json.bean.procedure.length - 1)){
item.operator = '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal layui-btn-disabled">生成验收单</button>';
} else {
item.operator = '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal layui-btn-disabled">工序验收</button>';
}
}
} else if (item.state == 2){
item.stateName = "<span class='state-up'>已验收</span>"
}
});
$.each(json.bean.materiel, function(i, item) {
item.unitPrice = parseFloat(item.unitPrice).toFixed(2);
});
showGrid({
id: "showForm",
url: flowableBasePath + "erpmachin006",
params: {id: parent.rowId},
pagination: false,
method: 'GET',
template: $("#useTemplate").html(),
ajaxSendLoadBefore: function(hdb, json){
needNum = json.bean.needNum;
hdb.registerHelper('compare1', function(v1, v2, options) {
return (parseFloat(v1) * parseFloat(v2)).toFixed(2);
});
var loadOperatorBtn = false;
$.each(json.bean.procedure, function(i, item) {
item.unitPrice = parseFloat(item.unitPrice).toFixed(2);
if(item.state == 1){
item.stateName = "<span class='state-down'>待验收</span>";
if(!loadOperatorBtn){
loadOperatorBtn = true;
if(i == (json.bean.procedure.length - 1)){
item.operator = '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal acceptance" rowId="' + item.id + '" subType="2">生成验收单</button>';
} else {
item.operator = '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal acceptance" rowId="' + item.id + '" subType="1">工序验收</button>';
}
} else {
if(i == (json.bean.procedure.length - 1)){
item.operator = '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal layui-btn-disabled">生成验收单</button>';
} else {
item.operator = '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal layui-btn-disabled">工序验收</button>';
}
}
} else if (item.state == 2){
item.stateName = "<span class='state-up'>已验收</span>"
}
});
$.each(json.bean.material, function(i, item) {
item.unitPrice = parseFloat(item.unitPrice).toFixed(2);
});
$("#contentIframe").attr("src", "../../tpl/erpcommon/erpOrderFlowLine.html?rowId=" + json.bean.id + "&type=3");
},
ajaxSendAfter: function (json) {
matchingLanguage();
form.render();
}
});
$("#contentIframe").attr("src", "../../tpl/erpcommon/erpOrderFlowLine.html?rowId=" + json.bean.id + "&type=3");
},
ajaxSendAfter: function (json) {
matchingLanguage();
form.render();
}
});
}
// 打印
$("body").on("click", "#jprint", function (e) {
$("#showForm").jqprint({
......
......@@ -15,8 +15,9 @@ layui.config({
showGrid({
id: "showForm",
url: flowableBasePath + "erpmachin006",
params: {rowId: parent.rowId},
params: {id: parent.rowId},
pagination: false,
method: 'GET',
template: $("#useTemplate").html(),
ajaxSendLoadBefore: function(hdb) {
hdb.registerHelper('compare1', function(v1, v2, options) {
......
......@@ -65,8 +65,8 @@ layui.config({
var chooseIndex = JSON.stringify(dubClick.data('index'));
var obj = json.rows[chooseIndex];
//根据加工单id获取该单据下的所有单据中商品以及剩余领料数量
AjaxPostUtil.request({url: flowableBasePath + "erpmachin011", params: {rowId: obj.id}, type: 'json', callback: function(json) {
// 根据加工单id获取该单据下的所有单据中商品以及剩余领料数量
AjaxPostUtil.request({url: flowableBasePath + "erpmachin011", params: {id: obj.id}, type: 'json', method: 'GET', callback: function(json) {
obj.norms = [].concat(json.rows);
parent.machinMation = obj;
......
......@@ -215,8 +215,8 @@ layui.config({
//单位回显
$("#unitId" + (rowNum - 1)).html(getDataUseHandlebars(selOption, {rows: item.unitList}));
$("#unitId" + (rowNum - 1)).val(item.normsId);
//商品回显
$("#materialId" + (rowNum - 1)).val(item.productName + "(" + item.productModel + ")");
//商品回显materialModel
$("#materialId" + (rowNum - 1)).val(item.materialName + "(" + item.materialModel + ")");
$("#currentTock" + (rowNum - 1)).html(item.currentTock);//库存回显
//补充数量
$("#rkNum" + (rowNum - 1)).val(0);
......
......@@ -251,7 +251,7 @@ layui.config({
$("#unitId" + (rowNum - 1)).html(getDataUseHandlebars(selOption, {rows: item.unitList}));
$("#unitId" + (rowNum - 1)).val(item.normsId);
//商品回显
$("#materialId" + (rowNum - 1)).val(item.productName + "(" + item.productModel + ")");
$("#materialId" + (rowNum - 1)).val(item.materialName + "(" + item.materialModel + ")");
$("#currentTock" + (rowNum - 1)).html(item.currentTock);//库存回显
//建议数量
$("#rkNum" + (rowNum - 1)).val(0);
......
......@@ -218,7 +218,7 @@ layui.config({
$("#unitId" + (rowNum - 1)).html(getDataUseHandlebars(selOption, {rows: item.unitList}));
$("#unitId" + (rowNum - 1)).val(item.normsId);
//商品回显
$("#materialId" + (rowNum - 1)).val(item.productName + "(" + item.productModel + ")");
$("#materialId" + (rowNum - 1)).val(item.materialName + "(" + item.materialModel + ")");
$("#currentTock" + (rowNum - 1)).html(item.currentTock);//库存回显
//所需领料总数量
$("#productionNum" + (rowNum - 1)).html(item.needNumber);
......
......@@ -39,7 +39,7 @@ layui.config({
});
function loadData(){
AjaxPostUtil.request({url:flowableBasePath + "erppick005", params: {rowId: parent.rowId}, type: 'json', callback: function (json) {
AjaxPostUtil.request({url:flowableBasePath + "erppick005", params: {id: parent.rowId}, type: 'json', method: 'GET', callback: function (json) {
var data = json.bean;
if (!isNull(data.machinId)){
$("#machinOrder").val(data.machinNum);
......@@ -60,7 +60,7 @@ layui.config({
$("#unitId" + (rowNum - 1)).html(getDataUseHandlebars(selOption, {rows: item.unitList}));
$("#unitId" + (rowNum - 1)).val(item.normsId);
//商品回显
$("#materialId" + (rowNum - 1)).val(item.productName + "(" + item.productModel + ")");
$("#materialId" + (rowNum - 1)).val(item.materialName + "(" + item.materialModel + ")");
$("#currentTock" + (rowNum - 1)).html(item.currentTock);//库存回显
$.each(data.machinToMation, function(j, bean){
if(bean.normsId == item.normsId){
......@@ -263,7 +263,7 @@ layui.config({
$("#unitId" + (rowNum - 1)).html(getDataUseHandlebars(selOption, {rows: item.unitList}));
$("#unitId" + (rowNum - 1)).val(item.normsId);
//商品回显
$("#materialId" + (rowNum - 1)).val(item.productName + "(" + item.productModel + ")");
$("#materialId" + (rowNum - 1)).val(item.materialName + "(" + item.materialModel + ")");
$("#currentTock" + (rowNum - 1)).html(item.currentTock);//库存回显
//所需领料总数量
$("#productionNum" + (rowNum - 1)).html(item.needNumber);
......
......@@ -160,9 +160,9 @@
</tr>
</thead>
<tbody id="useTable">
{{#each materiel}}
{{#each material}}
<tr>
<td>{{productName}}({{productModel}})</td>
<td>{{materialName}}({{materialModel}})</td>
<td>{{unitName}}</td>
<td>{{needNumber}}</td>
<td>{{unitPrice}}</td>
......
......@@ -132,9 +132,9 @@
</tr>
</thead>
<tbody id="useTable" class="insurance-table">
{{#each materiel}}
{{#each material}}
<tr>
<td>{{productName}}({{productModel}})</td>
<td>{{materialName}}({{materialModel}})</td>
<td>{{unitName}}</td>
<td>{{needNumber}}</td>
<td>{{unitPrice}}</td>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册