// 定义字段映射 const FieldKeysMap = { "STK_TransferDirect": "FID,FSrcStockLocId.FF102029.FName,FSrcStockId.FName,FDestStockId.FName,FMaterialId.FNumber,FBOXNO_LT,FQty,FENCHASENUM_LT,FAuxPropId.FF101501.FDataValue,FLot.FNumber,FNoteEntry,FBillNo,FStockerId.FName,FDate,FDestStockId.FNumber" }; export function getSearchParam(condition) { let FilterString = [{ "FieldName": "FDocumentStatus", "Compare": "105", "Value": "A", "Left": "(", "Right": "", "Logic": 1 }, { "FieldName": "FDocumentStatus", "Compare": "105", "Value": "D", "Left": "", "Right": ")", "Logic": 0 }, { "FieldName": "FSrcStockId.FName", "Compare": "17", "Value": "面料", "Left": "", "Right": "", "Logic": 0 }, { "FieldName": "FBillNo", "Compare": "17", "Value": condition.billNo, "Left": "", "Right": "", "Logic": 0 }, { "FieldName": "FTransferDirect", "Compare": "29", "Value": "GENERAL", "Left": "", "Right": "", "Logic": 0 }, { "FieldName": "FScanType.FDataValue", "Compare": "67", "Value": "调拨入库扫描", "Left": "(", "Right": "", "Logic": 1 }, { "FieldName": "FScanType.FDataValue", "Compare": "67", "Value": "调拨出库扫描", "Left": "", "Right": ")", "Logic": 0 }, { "FieldName": "FDate", "Compare": "39", "Value": condition.range[0], "Left": "(", "Right": "", "Logic": "0" }, { "FieldName": "FDate", "Compare": "16", "Value": condition.range[1], "Left": "", "Right": ")", "Logic": "0" } ] let FieldKeys = "FID,FSrcStockLocId.FF102029.FName,FSrcStockId.FName,FDestStockId.FName,FMaterialId.FNumber,FBOXNO_LT,FQty,FENCHASENUM_LT,FAuxPropId.FF101501.FDataValue,FLot.FNumber,FNoteEntry,FBillNo,FStockerId.FName,FDate,FDestStockId.FNumber" console.log(condition.FBillType) console.log(FieldKeys) return { "parameters": [{ "FormId": condition.FormId, "FieldKeys": FieldKeys, "FilterString": FilterString }] } } export function getBillDetailListParam(condition) { console.log(condition) return { "parameters": [{ "FormId": condition.FormId, "FieldKeys": FieldKeysMap[condition.FormId], "FilterString": [{ "Left": "", "FieldName": "FID", "Compare": "338", "Value": condition.selectedFID, "Right": "", "Logic": 0 }], }] } } // 定义一个函数来创建库存查询请求数据 export function createInventoryQueryRequest(value) { return { parameters: [{ FormId: "STK_TransferDirect", FieldKeys: "fID", FilterString: [{ Left: "", FieldName: "FSrcStockLocId.FF102029.FName", Compare: "67", Value: value, Right: "", Logic: 0 }, { Left: "", FieldName: "FBaseQty", Compare: "21", Value: "0", Right: "", Logic: 0 } ] }] }; } function getActualQtyKey(FormId) { const keyMap = { 'LT_PRD_PMCWorkBench': 'FActualQty', 'SP_PickMtrl': 'FActualQty', 'STK_MisDelivery': 'FQty', 'PUR_MRB': 'FRMREALQTY' }; return keyMap[FormId] || 'FQty'; } function createEntityObject(item, actualQtyKey) { return { "FEntryID": item["FEntity.FEntryID"], "FInventoryQty": item["FInventoryQty"], "FAuxPropId": { "FAUXPROPID__FF101501": { "FNumber": item["FAuxPropId.FF101501.FDATAVALUE"] || item["FAuxPropId.FF101501.FDataValue"] } }, "FStockLocId": { "FSTOCKLOCID__FF102029": { "Fname": item["FStockLocId.FF102029.fname"] || item["FStockLocId.FF102029.FName"] } }, "FLot": { "FNumber": item["Flot.FNumber"] }, "FENCHASENUM_LT": item["FENCHASENUM.LT"], [actualQtyKey]: item[actualQtyKey] // 使用动态键名 }; } export function getCreateSaveParam(FormId, username, indexList) { const targetFID = data; const actualQtyKey = getActualQtyKey(FormId); const FEntityObjects = indexList .filter(item => item.FID === targetFID) .map(item => createEntityObject(item, actualQtyKey)); const datetime = new Date().toISOString(); return { "parameters": [ FormId, { "NeedUpDateFields": [], "NeedReturnFields": [], "IsDeleteEntry": "true", "SubSystemId": "", "IsVerifyBaseDataField": "false", "IsEntryBatchFill": "true", "ValidateFlag": "true", "NumberSearch": "true", "IsAutoAdjustField": "false", "InterationFlags": "", "IgnoreInterationFlag": "", "IsControlPrecision": "false", "ValidateRepeatJson": "false", "Model": { "FID": 0, "FBillTypeID": { "FNUMBER": "ZJDB01_SYS" }, "FBizType": "NORMAL", "FTransferDirect": "GENERAL", "FTransferBizType": "InnerOrgTransfer", "FStockOutOrgId": { "FNumber": "100" }, "FOwnerTypeOutIdHead": "BD_OwnerOrg", "FOwnerOutIdHead": { "FNumber": "100" }, "FStockOrgId": { "FNumber": "100" }, "FIsIncludedTax": true, "FIsPriceExcludeTax": true, "FExchangeTypeId": { "FNUMBER": "HLTX01_SYS" }, "FOwnerTypeIdHead": "BD_OwnerOrg", "FSETTLECURRID": { "FNUMBER": "PRE001" }, "FExchangeRate": 1.0, "FOwnerIdHead": { "FNumber": "100" }, "FStockerId": { "FNumber": username }, "FDate": datetime, "FBaseCurrId": { "FNumber": "PRE001" }, "FPrintNum_LT": 0, "FScanType": { "FNumber": "TransferInStockScan" }, "FExtTransType_LT": { "FNumber": "ZCFX" }, "FWriteOffConsign": false, "FBillEntry": FEntityObjects } } ] }; } export function getCreateSubmitParam(FormId, data) { const params = { "parameters": [ FormId, { "CreateOrgId": 0, "Numbers": [], "Ids": data.toString(), "SelectedPostId": 0, "UseOrgId": 0, "NetworkCtrl": "", "IgnoreInterationFlag": "" } ] }; console.log(params); return params; } export function getAuditParam(FormId, data) { const params = { "parameters": [ FormId, { "CreateOrgId": 0, "Numbers": [], "Ids": data.toString(), "InterationFlags": "", "UseOrgId": 0, "NetworkCtrl": "", "IsVerifyProcInst": "true", "IgnoreInterationFlag": "", "UseBatControlTimes": "false" } ] } console.log(params) return params } //根据条形码查编号批号 export function getFLotFNumber(lotCode) { return { parameters: [{ FormId: "LT_BD_MtlLotCodeMap", FieldKeys: "FID,FNumber,FMaterialId.FNumber,FBPMaterialName,FLot.FNumber,FStockId.FName,FStockLocId.FF102029.FNumber", FilterString: [{ "Left": "", "FieldName": "FNumber", "Compare": "67", "Value": lotCode, "Right": "", "Logic": 0 }, ] }] }; } //根据编号批号查即时库存 export function getInventory(lot, material) { return { parameters: [{ FormId: "STK_Inventory", FieldKeys: "FStockLocId.FF102029.FNumber,FStockLocId.FF102029.FName,FStockName,FMaterialName,FBaseQty,FOwnerName,FOwnerTypeId,FAuxPropId.FF101501.FDataValue,FModel", FilterString: [{ "Left": "", "FieldName": "FLot.FNumber", "Compare": "67", "Value": lot, "Right": "", "Logic": 0 }, { "Left": "", "FieldName": "FMaterialId.FNumber", "Compare": "67", "Value": material, "Right": "", "Logic": 0 }, { "Left": "", "FieldName": "FBaseQty", "Compare": "70", "Value": "0", "Right": "", "Logic": 0 } ] }] }; }