// 定义字段映射 const FieldKeysMap = { "STK_MISCELLANEOUS": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber", "STK_InStock": "FID,FInStockEntry_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FRealQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber", "STK_OEMInStock": "FID,FBillEntry_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber", "LT_PRD_PMCWorkBench": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FActualQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber", "SP_ReturnMtrl": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber", "STK_MisDelivery": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber", }; export function getStorageSearchParam(condition) { let FilterString = [{ "Left": "(", "FieldName": "FDocumentStatus", "Compare": "105", "Value": "A", "Right": "", "Logic": 1 }, { "Left": "", "FieldName": "FDocumentStatus", "Compare": "105", "Value": "D", "Right": ")", "Logic": 0 }, { "Left": "", "FieldName": "FStockDirect", "Compare": "29", "Value": "GENERAL", "Right": "", "Logic": 0 }, { "Left": "(", "FieldName": "FEntryStoreType_LT.FDataValue", "Compare": "67", "Value": "自产入库", "Right": "", "Logic": 1 }, { "Left": "", "FieldName": "FEntryStoreType_LT.FDataValue", "Compare": "67", "Value": "衬衣面料内部调入", "Right": ")", "Logic": 0 }, { "Left": "", "FieldName": "FEnchaseNum_LT", "Compare": "67", "Value": condition.FEnchaseNum_LT, "Right": "", "Logic": 0 }] if (condition.FormId == "STK_InStock" || condition.FormId == "STK_OEMInStock"||condition.FormId == "SP_ReturnMtrl") { FilterString = [{ "Left": "(", "FieldName": "FDocumentStatus", "Compare": "105", "Value": "A", "Right": "", "Logic": 1 }, { "Left": "", "FieldName": "FDocumentStatus", "Compare": "105", "Value": "D", "Right": ")", "Logic": 0 }, { "Left": "", "FieldName": "FEnchaseNum_LT", "Compare": "67", "Value": condition.FEnchaseNum_LT, "Right": "", "Logic": 0 }] } if (condition.FormId == "LT_PRD_PMCWorkBench") { // FilterString = [{ "Left": "(", "FieldName": "FDocumentStatus", "Compare": "105", "Value": "A", "Right": "", "Logic": 1 }, { "Left": "", "FieldName": "FDocumentStatus", "Compare": "105", "Value": "D", "Right": ")", "Logic": 0 }, { "Left": "", "FieldName": "FEnchaseNum_LT", "Compare": "67", "Value": condition.FEnchaseNum_LT, "Right": "", "Logic": 0 }, { "Left": "", "FieldName": "FStockId.FName", "Compare": "17", "Value": "面料", "Right": "", "Logic": 0 }, { "Left": "", "FieldName": "FBillType", "Compare": "105", "Value": "d43d7e5b9def82fd11e3e603ca986cd9", "Right": "", "Logic": 0 } ] } if (condition.FormId == "STK_MisDelivery") { // FilterString = [{ "Left": "(", "FieldName": "FDocumentStatus", "Compare": "105", "Value": "A", "Right": "", "Logic": 1 }, { "Left": "", "FieldName": "FDocumentStatus", "Compare": "105", "Value": "D", "Right": ")", "Logic": 0 }, { "Left": "", "FieldName": "FEnchaseNum_LT", "Compare": "67", "Value": condition.FEnchaseNum_LT, "Right": "", "Logic": 0 }, { "Left": "", "FieldName": "FStockId.FName", "Compare": "17", "Value": "面料", "Right": "", "Logic": 0 }, { "Left": "", "FieldName": "FStockDirect", "Compare": "29", "Value": "RETURN", "Right": "", "Logic": 0 } ] } return { "parameters": [{ "FormId": condition.FormId, "FieldKeys": FieldKeysMap[condition.FormId], "FilterString": FilterString, }] } } export function getStorageByBillNoParam(condition) { return { "parameters": [{ "FormId": condition.FormId, "FieldKeys": FieldKeysMap[condition.FormId], "FilterString": [{ "Left": "", "FieldName": "FBillNo", "Compare": "338", "Value": condition.FBillNo, "Right": "", "Logic": 0 }], }] } } function createEntityObject(item, FEntryIDKey) { return { "FEntryID": item[FEntryIDKey+".FEntryID"], // "FInventoryQty": item["FInventoryQty"], // "FAuxPropId": { // "FAUXPROPID__FF101501": { // "FNumber": item["FAuxPropId.FF101501.FDATAVALUE"] // } // }, "FStockLocId": { "FSTOCKLOCID__FF102029": { "Fnumber": item["FStockLocId.FF102029.FNumber"] } }, // "FLot": { // "FNumber": item["Flot.FNumber"] // }, // "FENCHASENUM_LT": item["FENCHASENUM.LT"], // [actualQtyKey]: item[actualQtyKey] // 使用动态键名 }; } function getFEntryIDKey(FormId) { const keyMap = { 'STK_MISCELLANEOUS': 'FEntity', 'STK_InStock': 'FInStockEntry', 'STK_OEMInStock': 'FBillEntry', 'LT_PRD_PMCWorkBench': 'FEntity', 'SP_ReturnMtrl': 'FEntity', 'STK_MisDelivery': 'FEntity', }; return keyMap[FormId]; } export function getSaveParam(FormId, data, indexList) { const targetFID = data; const FEntryIDKey = getFEntryIDKey(FormId); const FEntityObjects = indexList .filter(item => item.FID === targetFID) .map(item => createEntityObject(item,FEntryIDKey)); const needUpdateFields = [ // "FInventoryQty", // "FAuxPropId", "FStockLocId", "FIsScanFabric", // "FLot", // "FENCHASENUM_LT", // actualQtyKey // 直接添加到数组中 ]; return { "parameters": [ FormId, { "NeedUpDateFields": needUpdateFields, "NeedReturnFields": ["FID"], "IsDeleteEntry": "true", "SubSystemId": "", "IsVerifyBaseDataField": "false", "IsEntryBatchFill": "true", "ValidateFlag": "true", "NumberSearch": "true", "IsAutoAdjustField": "false", "InterationFlags": "", "IgnoreInterationFlag": "", "IsControlPrecision": "false", "ValidateRepeatJson": "false", "Model": { "FID": targetFID, "FIsScanFabric": true, [FEntryIDKey]: FEntityObjects } } ] }; } export function getSubmitParam(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 }