123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- // 定义字段映射
- const FieldKeysMap = {
- "LT_STK_StockCount": "FID,FEntity_FEntryID,FBillNo,FIsCheck,FCheckTag,FStockId.fnumber,FStockId.FName,FStockLocId.FF102029.fname,FMaterialId.fnumber,FEnchaseNo,FBoxNo,FCheckNum,FAccountNum"
- };
- export function getSearchParam(condition) {
- let FilterString = [{ //其他出库
- "Left": "(",
- "FieldName": "FDocumentStatus",
- "Compare": "105",
- "Value": "A",
- "Right": "",
- "Logic": 1
- },
- // {//审核中
- // "Left": "",
- // "FieldName": "FDocumentStatus",
- // "Compare": "105",
- // "Value": "B",
- // "Right": "",
- // "Logic": 1
- // },
- {
- "Left": "",
- "FieldName": "FDocumentStatus",
- "Compare": "105",
- "Value": "D",
- "Right": ")",
- "Logic": 0
- }, {
- "Left": "",
- "FieldName": "FStockOrgId.FNumber",
- "Compare": "67",
- "Value": condition.FStockOrgId,
- "Right": "",
- "Logic": 0
- },
- {
- "FieldName": "FBillNo",
- "Compare": "17",
- "Value": condition.billNo,
- "Left": "",
- "Right": "",
- "Logic": 0
- },
- {
- "Left": "",
- "FieldName": "FStockId.FName",
- "Compare": "17",
- "Value": "面料",
- "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,FWorkCenterId.fname,FPickingPeople_LT.fname,FSTOCKERID.fname,FBillNo,FDate,FNote,FStockOrgId"
- console.log(condition.FBillType)
- if (condition.FBillType == "d43d7e5b9def82fc11e3e582178e4360") { //领料
- FilterString.push({
- "Left": "",
- "FieldName": "FBillType",
- "Compare": "105",
- "Value": condition.FBillType,
- "Right": "",
- "Logic": 0
- });
- console.log('aaaa')
- FieldKeys =
- "FID,FWorkCenterId_LT.fname,FApplicantId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId"
- }
- if (condition.FormId == "STK_MisDelivery") { //其他出库
- FilterString.push({
- "Left": "",
- "FieldName": "FStockDirect",
- "Compare": "29",
- "Value": "GENERAL",
- "Right": "",
- "Logic": 0
- });
- FieldKeys =
- "FID,FWorkCenterId.fname,FPickingPeople_LT.fname,FSTOCKERID.fname,FBillNo,FDate,FNote,FStockOrgId,FDeptId.FName,FPickerId.FName"
- }
- if (condition.FormId == "SP_PickMtrl" && condition.FBillType !== 'B') { //简单生产领料单
- FilterString.push({
- "Left": "",
- "FieldName": "FCollectStatus_LT",
- "Compare": "106",
- "Value": "B",
- "Right": "",
- "Logic": 0
- });
- FieldKeys =
- "FID,FWorkCenterId.fname,FPickerId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId,FPickingPeople_LT.FName,FCollectStatus_LT"
- }
- if (condition.FormId == "SP_PickMtrl" && condition.FBillType == 'B') { //简单生产领料单(智能)
- FilterString.push({
- "Left": "",
- "FieldName": "FCollectStatus_LT",
- "Compare": "105",
- "Value": "B",
- "Right": "",
- "Logic": 0
- });
- FieldKeys =
- "FID,FWorkCenterId.fname,FPickerId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId,FPickingPeople_LT.FName,FCollectStatus_LT"
- }
- if (condition.FormId == "PUR_MRB") { //采购退料单
- FieldKeys =
- "FID,FSupplierID.fname,FPURCHASERID.fname,FPURCHASEDEPTID.fname,FSTOCKERID.fname,FBillNo,FDate,FStockOrgId"
- }
- if (condition.FormId == "STK_OEMInStockRETURN") {
- FieldKeys =
- "FID,FCustId.FName,FDeptId_LT.FName,FBillNo,FSTOCKERID.fname,FDate,FNote,FStockOrgId"
- }
- if (condition.FormId == "SAL_OUTSTOCK") { //销售出库
- FieldKeys =
- "FID,FBillNo,FCustomerID.FName,FSalesManID.FName,FSaleDeptID.FName,FSTOCKERID.fname,FDate"
- }
- if (condition.FormId == "LT_STK_StockCount" && condition.FBillType == "6764c6f5bb0056") { //仓位盘点
- FilterString.push({
- "Left": "",
- "FieldName": "FBillTypeID",
- "Compare": "105",
- "Value": condition.FBillType,
- "Right": "",
- "Logic": 0
- });
- FieldKeys =
- // "FID,FBillNo,FCustomerID.FName,FSalesManID.FName,FSaleDeptID.FName,FSTOCKERID.fname,FDate"
- "FID,FBillNo,FDate,FCreatorId.FName"
- }
- console.log(FieldKeys)
- console.log(FilterString)
- return {
- "parameters": [{
- "FormId": condition.FormId,
- "FieldKeys": FieldKeys,
- "FilterString": FilterString
- }]
- }
- }
- export function getBillDetailListParam(condition) {
- console.log(condition)
- let FieldKeys = FieldKeysMap[condition.FormId]
- if (condition.FormId == "SP_PickMtrl" && condition.FBillType == 'B') {
- FieldKeys =
- "FID,FSumEntity_FEntryID,FBillNo,FSTOCKERID.fname,FSumStockLocId.FF102029.fname,FSumMaterialId.fnumber,FSumBoxNo_LT,FSumActualQty,FSumEnchaseNum_LT,FSumAuxPropId.FF101501.FNumber,FSumLot.FNumber,FWorkCenterId.fname,FDate,FPickerId.fname,FWorkShopId.fname,FPickingPeople_LT.FName"
- }
- return {
- "parameters": [{
- "FormId": condition.FormId,
- "FieldKeys": FieldKeys,
- "FilterString": [{
- "Left": "",
- "FieldName": "FID",
- "Compare": "338",
- "Value": condition.selectedFID,
- "Right": "",
- "Logic": 0
- }],
- }]
- }
- }
- // 定义一个函数来创建库存查询请求数据
- export function createInventoryQueryRequest(value) {
- return {
- parameters: [{
- FormId: "STK_Inventory",
- FieldKeys: "fID",
- FilterString: [{
- Left: "",
- FieldName: "FStockLocId.FF102029.FName",
- Compare: "67",
- Value: value,
- Right: "",
- Logic: 0
- },
- {
- Left: "",
- FieldName: "FBaseQty",
- Compare: "21",
- Value: "0",
- Right: "",
- Logic: 0
- }
- ]
- }]
- };
- }
- function createEntityObject(item) {
- return {
- "FEntryID": item["FEntity.FEntryID"],
- "FStockId": {
- "FNumber": item["FStockId.fnumber"]
- },
- "FStockLocId": {
- "FSTOCKLOCID__FF102029": {
- "FNumber": item["FStockLocId.FF102029.fname"]
- }
- },
- "FMaterialId": {
- "FNumber": item["FMaterialId.fnumber"]
- },
- "FEnchaseNo": item["FEnchaseNo"],
- "FAuxPropId": {
- "FAUXPROPID__FF101501": {
- "FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
- },
- },
- "FLot": {
- "FNumber": item["FLot.FNumber"]
- },
- "FAccountNum": item["FAccountNum"],
- "FCheckTag": item["FCheckTag"],
- "FCheckNum":item["FCheckNum"],
- "FBoxNo":item["FBoxNo"]
- // [actualQtyKey]: item[actualQtyKey] // 使用动态键名
- };
- }
- // function createEntityObject2(item) {
- // return {
- // "FEntryID": item["FSumEntity.FEntryID"],
- // "FSumAuxPropId": {
- // "FSUMAUXPROPID__FF101501": {
- // "FNumber": item["FSumAuxPropId.FF101501.FDATAVALUE"]
- // }
- // },
- // "FSumStockLocId": {
- // "FSUMSTOCKLOCID__FF102029": {
- // "FNumber": item["FSumStockLocId.FF102029.fname"]
- // }
- // },
- // "FSumLot": {
- // "FNumber": item["FSumLot.FNumber"]
- // },
- // "FSumEnchaseNum_LT": item["FSumEnchaseNum.LT"],
- // "FSumActualQty": item["FSumActualQty"]
- // };
- // }
- export function getSaveParam(FormId, targetFID, indexList) {
- // const targetFID = data;
- // const actualQtyKey = getActualQtyKey(FormId);
- // const InventoryQtyKey = getFInventoryQtyKey(FormId);
- // const entityKey = getEntityKey(FormId);
- // const StockLocIdKey = getStockLocIdKey(FormId);
- const FEntityObjects = indexList
- .filter(item => item.FID === targetFID)
- .map(item => createEntityObject(item));
- const needUpdateFields = [
- // InventoryQtyKey,
- // "FAuxPropId",
- "FIsCheck",
- "FStockId",
- "FStockLocId",
- "FMaterialId",
- "FEnchaseNo",
- "FAuxPropId", //等级
- "FLot", //批号
- "FAccountNum",
- "FCheckTag",
- "FCheckNum",
- "FBoxNo"
- ];
- 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,
- "FIsCheck": indexList[0]["FIsCheck"],
- // "FIsScanFabric": true,
- "FEntity": FEntityObjects
- }
- }
- ]
- };
- }
- export function createSubmitCondition() {
- return {
- FormId: uni.getStorageSync('formId'),
- selectedFID: this.selected,
- FBillType: uni.getStorageSync('fbillType')
- };
- }
- export function getCreateParam(FormId) {
- // const FEntityObjects = indexList
- // .filter(item => item.FID === targetFID)
- // .map(item => createEntityObject(item));
- // const needUpdateFields = [
- // "FStockId",
- // "FStockLocId",
- // "FMaterialId",
- // "FEnchaseNo",
- // "FAuxPropId", //等级
- // "FLot", //批号
- // "FAccountNum"
- // ];
- 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": "CWPD"
- },
- "FStockOrgId": {
- "FNumber": uni.getStorageSync('FStockOrgId')
- },
- "FIsCheck": "A"
- }
- }
- ]
- };
- }
- 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 getQueryStockParam(Id, selectedFID) {
- const params = {
- usertoken: "99302b4923aa42298c5922b7b68bcff9",
- billId: Id,
- queryType: "StockQuery",
- stockLocs: selectedFID,
- date: ''
- }
- 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 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 createSearchCondition(range, billNo) {
- return {
- "FormId": uni.getStorageSync('formId'),
- "FBillType": uni.getStorageSync('fbillType'),
- "FStockOrgId": uni.getStorageSync('FStockOrgId'),
- "billNo": billNo,
- "range": range
- };
- }
|