| | |
| | | printCheck = function(){ |
| | | var data = view.get("#dataGridMain.currentEntity"); |
| | | if(!data) return; |
| | | if("OUT" == data.get("type")){ |
| | | $alert("出库数据不支持打印!"); |
| | | return; |
| | | } |
| | | |
| | | if("DEL" == data.get("recordStatus")){ |
| | | $alert("删除的数据不支持打印!"); |
| | | return; |
| | | } |
| | | if("ERROR" == data.get("recordStatus")){ |
| | | $alert("异常终止的数据不支持打印!"); |
| | | $alert("异常处理的信息不支持打印!"); |
| | | return; |
| | | } |
| | | view.get("#ajaxPrintCheck").set("parameter",data).execute(function(result){ |
| | |
| | | }); |
| | | }; |
| | | |
| | | /** |
| | | * 批量打印,多选 |
| | | */ |
| | | printBatchCheck = function(){ |
| | | var datas = view.get("#dataGridMain").get("selection"); |
| | | if(datas){ |
| | | if(datas.length <= 0){ |
| | | $alert("尚未选择数据!"); |
| | | return; |
| | | } |
| | | var LODOP = CLODOP; |
| | | LODOP.PRINT_INIT("称重单"); |
| | | LODOP.SET_PRINT_PAGESIZE(1,2100,1400, "A4"); |
| | | datas.each(function(data){ |
| | | //console.log(data); |
| | | if("DEL" == data.get("recordStatus")){ |
| | | $notify("删除的数据不支持打印!"); |
| | | return true; |
| | | } |
| | | if("ERROR" == data.get("recordStatus")){ |
| | | $notify("异常终止的数据不支持打印!"); |
| | | return true; |
| | | } |
| | | view.get("#ajaxPrintCheck").set("parameter",data).execute(function(result){ |
| | | LODOP.NewPage(); |
| | | LODOP.ADD_PRINT_HTM(0, 0, "100%","100%", result); |
| | | }); |
| | | }); |
| | | $notify("开始调用打印机程序!"); |
| | | LODOP.PREVIEW(); |
| | | }else{ |
| | | $alert("请勾选数据!"); |
| | | } |
| | | }; |
| | | |
| | | //打印称重单 |
| | | //打印过磅单 |
| | | printWeight = function(){ |
| | | var data = view.get("#dataGridMain.currentEntity"); |
| | | if(!data) return; |
| | | |
| | | if("DEL" == data.get("recordStatus")){ |
| | | $alert("删除的数据不支持打印!"); |
| | | return; |
| | | } |
| | | if("ERROR" == data.get("recordStatus")){ |
| | | $alert("异常终止的数据不支持打印!"); |
| | | $alert("异常处理的信息不支持打印!"); |
| | | return; |
| | | } |
| | | if("RECORD" != data.get("progress")){ |
| | |
| | | printShipWeight = function(){ |
| | | var data = view.get("#dataGridMain.currentEntity"); |
| | | if(!data) return; |
| | | |
| | | if("DEL" == data.get("recordStatus")){ |
| | | $alert("删除的数据不支持打印!"); |
| | | return; |
| | | } |
| | | if("ERROR" == data.get("recordStatus")){ |
| | | $alert("异常终止的数据不支持打印!"); |
| | | return; |
| | | } |
| | |
| | | LODOP.PREVIEW(); |
| | | }; |
| | | |
| | | /** |
| | | * 批量打印,多选 |
| | | */ |
| | | printBatchWeight = function(){ |
| | | var datas = view.get("#dataGridMain").get("selection"); |
| | | if(datas){ |
| | | if(datas.length <= 0){ |
| | | $alert("尚未选择数据!"); |
| | | return; |
| | | } |
| | | var LODOP = CLODOP; |
| | | LODOP.PRINT_INIT("称重单"); |
| | | var companyId = datas[0].get("companyId"); |
| | | if(companyId && companyId == "5016"){ |
| | | //大湾区定制 |
| | | LODOP.SET_PRINT_PAGESIZE(1,1050,1400, ""); |
| | | }else { |
| | | LODOP.SET_PRINT_PAGESIZE(1,2100,1400, "A4"); |
| | | } |
| | | |
| | | datas.each(function(data){ |
| | | //console.log(data); |
| | | if("DEL" == data.get("recordStatus")){ |
| | | $notify("删除的数据不支持打印!"); |
| | | return true; |
| | | } |
| | | if("ERROR" == data.get("recordStatus")){ |
| | | $notify("异常终止的数据不支持打印!"); |
| | | return true; |
| | | } |
| | | if("RECORD" != data.get("progress")){ |
| | | $notify("流程未完成不支持打印!"); |
| | | return true; |
| | | } |
| | | view.get("#ajaxPrint").set("parameter",data).execute(function(result){ |
| | | //console.log(result); |
| | | LODOP.NewPage(); |
| | | LODOP.ADD_PRINT_HTM(0, 0, "100%","100%", result); |
| | | }); |
| | | }); |
| | | $notify("开始调用打印机程序!"); |
| | | LODOP.PREVIEW(); |
| | | }else{ |
| | | $alert("请勾选数据!"); |
| | | } |
| | | }; |
| | | |
| | | |
| | | //打印结算单 |
| | | printPay = function(){ |
| | | $alert("打印模版未定义……"); |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 自动计算 |
| | | * @param name |
| | | */ |
| | | deAutoByWeight = function(name){ |
| | | |
| | | if(null == name) name = "1"; |
| | | |
| | | var curData = view.get("#dsMain.data:#"); |
| | | var fullWeight = curData.get("fullWeight"); |
| | | var emptyWeight = curData.get("emptyWeight"); |
| | | |
| | | if(fullWeight == 0 || emptyWeight == 0){ |
| | | return; |
| | | } |
| | | // 净重 |
| | | var netWeight = Number(fullWeight) - Number(emptyWeight); |
| | | |
| | | if (netWeight <= 0){ |
| | | $notify("净重小于0,当前称重存在逻辑问题"); |
| | | return; |
| | | } |
| | | |
| | | //扣重信息 |
| | | var deHandle = curData.get("deHandle"), deCheck = curData.get("deCheck"), dePackage = curData.get("dePackage"), addCheck = curData.get("addCheck"); |
| | | |
| | | var deSum = Number(deHandle) + Number(deCheck) + Number(dePackage); |
| | | |
| | | |
| | | /** 入库重量 = 净重 - 总扣重 */ |
| | | recordWeight = Number(netWeight) - Number(deSum); |
| | | |
| | | /** 结算重量 = 净重 - 总扣重 + 增重 */ |
| | | settleWeight = Number(netWeight) - Number(deSum) + Number(addCheck); |
| | | |
| | | curData.set("netWeight",netWeight); |
| | | curData.set("settleWeight",settleWeight); |
| | | curData.set("recordWeight",recordWeight); |
| | | }; |