123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- // 定义字段映射
- 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
- }
|