123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420 |
- // 定义字段映射
- 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 actualQtyKey = getActualQtyKey(FormId);
- const FEntityObjects = indexList
- .map(item => createEntityObject(item, actualQtyKey));
- const datetime = new Date().toISOString();
- const entry = indexList.map(getEntityParam);
- 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": {
- "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"
- },
- "FCreatorId": {
- "FName": username
- },
- "FCreateDate": datetime,
- "FWriteOffConsign": false,
- "FBillEntry": entry
- }
- }
- ]
- };
- }
- function getEntityParam(item) {
- return {
- "FENCHASENUM_LT": item.FCMKBarCode,
- "FRowType": "Standard",
- "FMaterialId": {
- "FNumber": item["FMaterialId.FNumber"]
- },
- "FCMKBarCode": item.FCMKBarCode,
- "FAuxPropId": {
- "FAUXPROPID__FF101501": {
- "FNumber": item["FAuxPropId.FF101501.FDataValue"]
- }
- },
- "FSrcStockId": {
- "FNumber": item["FStockId.FNumber"]
- },
- "FSrcStockLocId": {
- "FSRCSTOCKLOCID__FF102029": {
- "FNumber": item["FStockLocId.FF102029.FNumber"]
- }
- },
- "FDestStockId": {
- "FNumber": item["FDestStockId.FNumber"]
- },
- "FDestStockLocId": {
- "FDESTSTOCKLOCID__FF102029": {
- "FNumber": item["FDestStockLocId.FF102029.FNumber"]
- }
- },
- "FLot": {
- "FNumber": item["FLot.FNumber"]
- },
- "FUnitID": {
- "FNumber": item["FUnitID.FNumber"] || item["FBaseUnitId.FNumber"]
- },
- "FDestLot": {
- "FNumber": item["FLot.FNumber"]
- },
- "FQty": item.FQty || item.FBaseQty,
- "FKeeperTypeOutId": item.FKeeperTypeId,
- "FOwnerTypeId": item.FOwnerTypeId,
- "FKeeperOutId": {
- "FNumber": item["FKeeperId.FNumber"]
- },
- "FOwnerTypeOutId": item.FOwnerTypeId,
- "FISFREE": false,
- "FOwnerId": {
- "FNumber": item["FOwnerId.FNumber"]
- },
- "FOwnerOutId": {
- "FNumber": item["FOwnerId.FNumber"]
- },
- "FBaseUnitId": {
- "FNumber": item["FBaseUnitId.FNumber"]
- },
- "FSrcStockStatusId": {
- "FNumber": "KCZT01_SYS"
- },
- "FDestStockStatusId": {
- "FNumber": "KCZT01_SYS"
- },
- "FBaseQty": item.FBaseQty,
- "FKeeperTypeId": item.FKeeperTypeId,
- "FKeeperId": {
- "FNumber": item["FKeeperId.FNumber"]
- }
- };
- }
- 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,FStockId.FNumber,FKeeperId.FNumber,FKeeperTypeId,FMaterialName,FBaseQty,FOwnerName,FOwnerId.FNumber,FOwnerTypeId,FAuxPropId.FF101501.FDataValue,FModel,FBaseUnitId.FNumber",
- 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
- }
- ]
- }]
- };
- }
|