a
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
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":
|
||||
val = e.Value
|
||||
isLong = val.find("_")
|
||||
if isLong == -1:
|
||||
sqlL = """/*dialect*/
|
||||
SELECT FBARCODE
|
||||
FROM T_BD_BARCODEMAINEX t0
|
||||
WHERE t0.FID = {0}
|
||||
""".format(e.Value)
|
||||
dataList = DBServiceHelper.ExecuteDynamicObject(this.Context, sqlL)
|
||||
val = dataList[0]["FBARCODE"]
|
||||
|
||||
if val != "":
|
||||
# raise Exception(JsonUtil.Serialize(this.View.Model.DataObject))
|
||||
infoList = val.split("_")
|
||||
flag = False;
|
||||
entity = this.View.Model.DataObject["FEntity"]
|
||||
# raise Exception(JsonUtil.Serialize(entity))
|
||||
if infoList.Count < 3:
|
||||
this.View.Model.SetValue("FverifyRes","无效的二维码!")
|
||||
this.View.GetControl("FverifyRes").SetCustomPropertyValue("ForeColor", "#FF3300")
|
||||
# this.View.Model.SetValue("FAACValue","");
|
||||
this.View.UpdateView();
|
||||
|
||||
e.Value = "";
|
||||
control = this.View.GetControl("FAACValue");
|
||||
control.SetFocus();
|
||||
e.Cancel = True;
|
||||
return;
|
||||
|
||||
materialNumber = infoList[0]
|
||||
# qty = float(0)
|
||||
lot = ""
|
||||
oTId = this.View.Model.DataObject["FObjectTypeId_Id"]
|
||||
|
||||
if oTId == "UHIK_PRD_PACKAGE_INSTOCK":
|
||||
# qty = float(infoList[1])
|
||||
lot = infoList[2]
|
||||
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;
|
||||
Reference in New Issue
Block a user