2024-12-05 15:39:19 +08:00
|
|
|
import clr
|
|
|
|
|
clr.AddReference("System")
|
|
|
|
|
clr.AddReference("System.Xml")
|
|
|
|
|
clr.AddReference("Kingdee.BOS")
|
|
|
|
|
clr.AddReference("Kingdee.BOS.Core")
|
|
|
|
|
clr.AddReference("Kingdee.BOS.DataEntity")
|
|
|
|
|
clr.AddReference("Kingdee.BOS.App")
|
|
|
|
|
clr.AddReference("Kingdee.BOS.Contracts")
|
|
|
|
|
clr.AddReference("Kingdee.BOS.ServiceHelper")
|
|
|
|
|
|
|
|
|
|
from Kingdee.BOS import *
|
|
|
|
|
from Kingdee.BOS.Contracts import *
|
|
|
|
|
from Kingdee.BOS.Core import *
|
|
|
|
|
from Kingdee.BOS.Core.List import *
|
|
|
|
|
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
|
|
|
|
|
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
|
|
|
|
|
from Kingdee.BOS.Core.Metadata.EntityElement import *
|
|
|
|
|
from Kingdee.BOS.Core.Bill import *
|
|
|
|
|
from Kingdee.BOS.Core.Metadata import *
|
|
|
|
|
from Kingdee.BOS.Orm.DataEntity import *
|
|
|
|
|
from Kingdee.BOS.Util import *
|
|
|
|
|
from Kingdee.BOS.Core.Util import *
|
|
|
|
|
from System import *
|
|
|
|
|
from System.Xml import *
|
|
|
|
|
from System.ComponentModel import *
|
|
|
|
|
from System.Collections.Generic import *
|
|
|
|
|
from System.Text import*
|
|
|
|
|
from Kingdee.BOS.ServiceHelper import *
|
|
|
|
|
|
|
|
|
|
_isFromBill = 0
|
|
|
|
|
_FFormId = ""
|
|
|
|
|
_billTypeId = ""
|
|
|
|
|
_billId = ""
|
|
|
|
|
_sellectedRowStr = List[ListSelectedRow]()
|
|
|
|
|
|
|
|
|
|
def OnInitialize(e):
|
|
|
|
|
global _isFromBill
|
|
|
|
|
_isFromBill = e.Paramter.GetCustomParameter("isFromBill");
|
|
|
|
|
|
|
|
|
|
global _FFormId
|
|
|
|
|
_FFormId = e.Paramter.GetCustomParameter("FFormId");
|
|
|
|
|
|
|
|
|
|
global _billTypeId
|
|
|
|
|
_billTypeId = e.Paramter.GetCustomParameter("billTypeId");
|
|
|
|
|
|
|
|
|
|
global _billId
|
|
|
|
|
_billId = e.Paramter.GetCustomParameter("billId")
|
|
|
|
|
|
|
|
|
|
global _sellectedRowStr
|
|
|
|
|
_sellectedRowStr = e.Paramter.GetCustomParameter("SelectedRows")
|
|
|
|
|
|
|
|
|
|
def OnLoad(e):
|
|
|
|
|
# dataJson = {
|
|
|
|
|
# "FFormId" :_FFormId
|
|
|
|
|
# ,"billTypeId":_billTypeId
|
|
|
|
|
# ,"billId":_billId
|
|
|
|
|
# }
|
|
|
|
|
# raise Exception(JsonUtil.Serialize(dataJson))
|
|
|
|
|
this.View.Model.SetValue("FObjectTypeId", _FFormId);
|
|
|
|
|
this.View.Model.SetValue("FBillTypeId", _billTypeId);
|
|
|
|
|
# this.View.Model.SetValue("FObjectTypeId", _FFormId, 0);
|
|
|
|
|
sqlL = "";
|
|
|
|
|
if _FFormId == "UHIK_PRD_PACKAGE_INSTOCK":
|
|
|
|
|
sqlL = """/*dialect*/
|
|
|
|
|
SELECT t0e.FMATERIALID,t0e.FGZLQTY AS 'FQty',FLOT
|
|
|
|
|
FROM T_PRD_PACKAGEINSTOCKENTRY t0e
|
|
|
|
|
WHERE t0e.FID = {0}
|
|
|
|
|
""".format(int(_billId))
|
|
|
|
|
|
|
|
|
|
if _sellectedRowStr == None or _sellectedRowStr == "":
|
|
|
|
|
return;
|
|
|
|
|
# raise Exception(JsonUtil.Serialize(_sellectedRowStr))
|
|
|
|
|
# dataList = DBServiceHelper.ExecuteDynamicObject(this.Context, sqlL)
|
|
|
|
|
dataList = _sellectedRowStr
|
|
|
|
|
if dataList !=None and dataList.Count > 0:
|
|
|
|
|
materialEntity = this.View.Model.BillBusinessInfo.GetEntryEntity("FEntity")
|
|
|
|
|
materialRows = this.View.Model.GetEntityDataObject(materialEntity)
|
|
|
|
|
materialRows.Clear()
|
|
|
|
|
|
|
|
|
|
#! 物料
|
|
|
|
|
matFld = this.View.BusinessInfo.GetField("FMaterialId");
|
|
|
|
|
|
|
|
|
|
#! 批号
|
|
|
|
|
lotFld = this.View.BusinessInfo.GetField("FLot");
|
|
|
|
|
|
|
|
|
|
#! 单位
|
|
|
|
|
unitFld = this.View.BusinessInfo.GetField("FUnitID");
|
|
|
|
|
|
|
|
|
|
#! 仓库
|
|
|
|
|
stockFld = this.View.BusinessInfo.GetField("FStockId");
|
|
|
|
|
|
|
|
|
|
for idx ,item in enumerate(dataList):
|
|
|
|
|
row = DynamicObject(materialEntity.DynamicObjectType);
|
|
|
|
|
fieldValues = item.FieldValues
|
|
|
|
|
# 物料
|
|
|
|
|
matId = fieldValues["FMaterialId_Id"]
|
|
|
|
|
row["FMaterialId_Id"] = matId
|
|
|
|
|
matObj = BusinessDataServiceHelper.LoadSingle(this.Context, matId, matFld.RefFormDynamicObjectType)
|
|
|
|
|
row["FMaterialId"] = matObj
|
|
|
|
|
|
|
|
|
|
# 数量
|
|
|
|
|
row["FQty"] = fieldValues["FQty"]
|
|
|
|
|
|
|
|
|
|
# 批号
|
|
|
|
|
lotId = int(fieldValues["FLot_Id"])
|
|
|
|
|
if lotId > 0:
|
|
|
|
|
row["FLot_Id"] = lotId
|
|
|
|
|
lotObj = BusinessDataServiceHelper.LoadSingle(this.Context, lotId, lotFld.RefFormDynamicObjectType)
|
|
|
|
|
row["FLot"] = lotObj
|
|
|
|
|
|
|
|
|
|
# 单位
|
|
|
|
|
unitId = int(fieldValues["FUnitID_Id"])
|
|
|
|
|
if unitId > 0:
|
|
|
|
|
row["FUnitID_Id"] = unitId
|
|
|
|
|
unitObj = BusinessDataServiceHelper.LoadSingle(this.Context, unitId, unitFld.RefFormDynamicObjectType)
|
|
|
|
|
row["FUnitID"] = unitObj
|
|
|
|
|
|
|
|
|
|
# 仓库
|
|
|
|
|
stockId = int(fieldValues["FStockId_Id"])
|
|
|
|
|
if stockId > 0:
|
|
|
|
|
row["FStockId_Id"] = stockId
|
|
|
|
|
stockObj = BusinessDataServiceHelper.LoadSingle(this.Context, stockId, stockFld.RefFormDynamicObjectType)
|
|
|
|
|
row["FStockId"] = stockObj
|
|
|
|
|
|
|
|
|
|
materialRows.Add(row)
|
|
|
|
|
|
|
|
|
|
def SetFverifyRes(msg,flag):
|
|
|
|
|
if flag == True:
|
|
|
|
|
this.View.Model.SetValue("FverifyRes",msg)
|
|
|
|
|
this.View.GetControl("FverifyRes").SetCustomPropertyValue("ForeColor", "#00994C")
|
|
|
|
|
else:
|
|
|
|
|
this.View.Model.SetValue("FverifyRes",msg)
|
|
|
|
|
this.View.GetControl("FverifyRes").SetCustomPropertyValue("ForeColor", "#FF3300")
|
|
|
|
|
|
|
|
|
|
def ButtonClick(e):
|
|
|
|
|
if e.Key.upper() == "FDORETURNVERIFY":
|
|
|
|
|
materialEntity = this.View.Model.BillBusinessInfo.GetEntryEntity("FEntity")
|
|
|
|
|
materialRows = this.View.Model.GetEntityDataObject(materialEntity)
|
|
|
|
|
this.View.ReturnToParentWindow(FormResult(materialRows));
|
|
|
|
|
this.View.Close();
|
|
|
|
|
|
|
|
|
|
def BeforeUpdateValue(e):
|
|
|
|
|
if str(e.Key).upper() == "FAACVALUE":
|
2025-01-01 08:21:58 +08:00
|
|
|
barCode = e.Value
|
|
|
|
|
if barCode != "":
|
2024-12-05 15:39:19 +08:00
|
|
|
sqlL = """/*dialect*/
|
2025-01-01 08:21:58 +08:00
|
|
|
SELECT t0.FBARCODE,t0.FBillNo,t0.FBILLSEQ,t0.FBILLFORMID,t0.FLOT,t0.FLOT_TEXT,t1.FNUMBER
|
|
|
|
|
FROM T_UNW_WMS_BARCODE t0
|
|
|
|
|
INNER JOIN T_BD_FMATERIAL t1 on t0.FMATERIALID = t1.FMATERIALID
|
|
|
|
|
WHERE t0.FBARCODE = '{0}'
|
|
|
|
|
AND t0.FBILLFORMID = 'PRD_MO'
|
2024-12-05 15:39:19 +08:00
|
|
|
""".format(e.Value)
|
|
|
|
|
dataList = DBServiceHelper.ExecuteDynamicObject(this.Context, sqlL)
|
2025-01-01 08:21:58 +08:00
|
|
|
if dataList.Count == 0:
|
|
|
|
|
this.View.Model.SetValue("FverifyRes","无效的二维码!")
|
|
|
|
|
this.View.GetControl("FverifyRes").SetCustomPropertyValue("ForeColor", "#FF3300")
|
|
|
|
|
return;
|
|
|
|
|
|
2024-12-05 15:39:19 +08:00
|
|
|
|
|
|
|
|
# raise Exception(JsonUtil.Serialize(this.View.Model.DataObject))
|
2025-01-01 08:21:58 +08:00
|
|
|
infoList = dataList[0]
|
2024-12-05 15:39:19 +08:00
|
|
|
flag = False;
|
|
|
|
|
entity = this.View.Model.DataObject["FEntity"]
|
|
|
|
|
|
2025-01-01 08:21:58 +08:00
|
|
|
materialNumber = infoList["FNUMBER"]
|
2024-12-05 15:39:19 +08:00
|
|
|
# qty = float(0)
|
|
|
|
|
lot = ""
|
|
|
|
|
oTId = this.View.Model.DataObject["FObjectTypeId_Id"]
|
|
|
|
|
|
|
|
|
|
if oTId == "UHIK_PRD_PACKAGE_INSTOCK":
|
|
|
|
|
# qty = float(infoList[1])
|
2025-01-01 08:21:58 +08:00
|
|
|
lot = infoList["FLOT_TEXT"]
|
2024-12-05 15:39:19 +08:00
|
|
|
for idx, item in enumerate(entity):
|
|
|
|
|
# raise Exception(JsonUtil.Serialize(item))
|
|
|
|
|
entityNumber = item["FMaterialId"]["Number"]
|
|
|
|
|
if entityNumber == materialNumber:
|
|
|
|
|
if item["FLot"] != None and item["FLot"]["Number"] == lot:
|
|
|
|
|
flag = True;
|
|
|
|
|
this.View.Model.SetValue("FVerified2", True , idx);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if flag == True:
|
|
|
|
|
this.View.Model.SetValue("FverifyRes","检验完成!")
|
|
|
|
|
this.View.GetControl("FverifyRes").SetCustomPropertyValue("ForeColor", "#00994C")
|
|
|
|
|
else:
|
|
|
|
|
this.View.Model.SetValue("FverifyRes","无效的二维码!")
|
|
|
|
|
this.View.GetControl("FverifyRes").SetCustomPropertyValue("ForeColor", "#FF3300")
|
|
|
|
|
|
|
|
|
|
e.Value = "";
|
|
|
|
|
control = this.View.GetControl("FAACValue");
|
|
|
|
|
control.SetFocus();
|
|
|
|
|
e.Cancel = True;
|