123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- // 定义字段映射
- 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"]
- }
- },
- "FStockLocId": {
- "FSTOCKLOCID__FF102029": {
- "Fname": item["FStockLocId.FF102029.fname"]
- }
- },
- "FLot": {
- "FNumber": item["Flot.FNumber"]
- },
- "FENCHASENUM_LT": item["FENCHASENUM.LT"],
- [actualQtyKey]: item[actualQtyKey] // 使用动态键名
- };
- }
- export function getSaveParam(FormId, data, indexList) {
- const targetFID = data;
- const actualQtyKey = getActualQtyKey(FormId);
- const FEntityObjects = indexList
- .filter(item => item.FID === targetFID)
- .map(item => createEntityObject(item, actualQtyKey));
- 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,
- "FEntity": 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
- }
|