export function getSearchParam(condition) {
	return {
		"parameters": [{
			"FormId": "LT_PRD_PMCWorkBench",
			"FieldKeys": "FID,FWorkCenterId_LT.fname,FApplicantId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId",
			"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": "FBillType",
					"Compare": "105",
					"Value": "d43d7e5b9def82fd11e3e60376ca0f55",
					"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
				},
				{
					"Left": "",
					"FieldName": "FIsUseOrReturnFab",
					"Compare": "74",
					"Value": false,
					"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"
				}
			],
		}]
	}
}
export function getBillDetailListParam(condition) {
	return {
		"parameters": [{
			"FormId": "LT_PRD_PMCWorkBench",
			"FieldKeys": "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FActualQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FEWorkCenterId_LT.fname,FEntrtyMemo,FDate,FApplicantId.fname,FSTOCKERID.fname,FStockActualQty,FWorkShopId.fname",
			"FilterString": [{
				"Left": "",
				"FieldName": "FID",
				"Compare": "338",
				"Value": condition.selectedFID,
				"Right": "",
				"Logic": 0
			}],
		}]
	}

}
export function getSaveParam(data, indexList) {
	let targetFID = data;
	// 使用 Array.prototype.filter 方法筛选符合条件的对象，并使用 Array.prototype.map 方法转换对象格式
	let FEntityObjects = indexList
		.filter(item => item.FID === targetFID)
		.map(item => ({
			"FEntryID": item["FEntity.FEntryID"],
			"FInventoryQty": item["FInventoryQty"],
			"FAuxPropId": {
				"FAUXPROPID__FF101501": {
					"FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
				}
			},
			"FStockLocId": {
				"FSTOCKLOCID__FF102029": {
					"FNumber": item["FStockLocId.FF102029.fname"]
				}
			},
			"FLot": {
				"FNumber": item["Flot.FNumber"]
			},
			"FENCHASENUM_LT": item["FENCHASENUM.LT"],
			"FActualQty": item["FActualQty"]
		}))
	return {
		"parameters": [
			"LT_PRD_PMCWorkBench",
			{
				"NeedUpDateFields": [
					"FInventoryQty", //即时库存数量
					"FAuxPropId", //等级
					"FStockLocId", //仓位
					"FIsScanFabric", //是否扫描
					"FLot", //批号
					"FENCHASENUM_LT", //装箱单号
					"FActualQty" //实发数量
				],
				"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(data) {
	const params = {
		"parameters": [
			"LT_PRD_PMCWorkBench",
			{
				"CreateOrgId": 0,
				"Numbers": [],
				"Ids": data.toString(),
				"SelectedPostId": 0,
				"UseOrgId": 0,
				"NetworkCtrl": "",
				"IgnoreInterationFlag": ""
			}
		]
	};
	console.log(params);
	return params;
}
export function getAuditParam(data) {
	const params = {
		"parameters": [
			"LT_PRD_PMCWorkBench",
			{
				"CreateOrgId": 0,
				"Numbers": [],
				"Ids": data.toString(),
				"InterationFlags": "",
				"UseOrgId": 0,
				"NetworkCtrl": "",
				"IsVerifyProcInst": "true",
				"IgnoreInterationFlag": "",
				"UseBatControlTimes": "false"
			}
		]
	}
	console.log(params)
	return params
}