【泛微接口】物料库存查询,单据状态修改
This commit is contained in:
		
							parent
							
								
									f580b77f21
								
							
						
					
					
						commit
						cf9b71da78
					
				|  | @ -0,0 +1,28 @@ | |||
| package tqq9.lc123.cloud.app.api.controller; | ||||
| 
 | ||||
| import com.drew.lang.annotations.NotNull; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiController; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiParam; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiPostMapping; | ||||
| import kd.bos.openapi.common.result.CustomApiResult; | ||||
| import tqq9.lc123.cloud.app.api.model.FWBillStateUpdModel; | ||||
| import tqq9.lc123.cloud.app.api.utils.ApiResultExt; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| @ApiController(value = "FWBillStateUpdController", desc = "泛微-单据状态更新接口") | ||||
| public class FWBillStateUpdController { | ||||
| 
 | ||||
|     @ApiPostMapping(value = "/FWBillUpd", desc = "泛微-单据状态更新api接口") | ||||
|     public CustomApiResult<ApiResultExt> billUpd | ||||
|             (@NotNull @ApiParam(value = "入参", example = "") FWBillStateUpdModel model) { | ||||
|         ApiResultExt resultExt = new ApiResultExt(); | ||||
|         List<ApiResultExt.ResultBean> results = new ArrayList<>(); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         resultExt.setResult(results); | ||||
|         return CustomApiResult.success(resultExt); | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,56 @@ | |||
| package tqq9.lc123.cloud.app.api.controller; | ||||
| 
 | ||||
| import com.drew.lang.annotations.NotNull; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiController; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiParam; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiPostMapping; | ||||
| import kd.bos.openapi.common.result.CustomApiResult; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import tqq9.lc123.cloud.app.api.model.FWInvQueryModel; | ||||
| import tqq9.lc123.cloud.app.api.result.FWInvQueryResult; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.util.*; | ||||
| 
 | ||||
| import static org.apache.batik.svggen.SVGStylingAttributes.set; | ||||
| 
 | ||||
| @ApiController(value = "FWInvQueryController", desc = "泛微查询库存接口") | ||||
| public class FWInvQueryController { | ||||
| 
 | ||||
|     @ApiPostMapping(value = "/FWInvQuery", desc = "泛微查询物料库存api接口") | ||||
|     public CustomApiResult<FWInvQueryResult> invQuery | ||||
|             (@NotNull @ApiParam(value = "入参", example = "") FWInvQueryModel model) { | ||||
|         FWInvQueryResult resultExt = new FWInvQueryResult(); | ||||
|         List<FWInvQueryResult.ResultBean> resultBeanList = new ArrayList<>(); | ||||
|         int failCount = 0;//失败数量 | ||||
| 
 | ||||
|         List<FWInvQueryModel.QueryModel> queryModels = model.getQueryModels(); | ||||
|         for (FWInvQueryModel.QueryModel queryModel : queryModels) { | ||||
|             String materialNumber = queryModel.getMaterialNumber(); | ||||
|             String lot = queryModel.getLot(); | ||||
|             QFilter qf1 = new QFilter("material.number", QCP.equals, materialNumber); | ||||
|             QFilter qf2 = new QFilter("material.number", QCP.in, lot); | ||||
|             DynamicObject[] realbalances = BusinessDataServiceHelper.load("im_inv_realbalance", "id,lotnum,avbbaseqty", new QFilter[]{qf1, qf2}); | ||||
|             if(realbalances != null && realbalances.length > 0){ | ||||
|                 String number = realbalances[0].getString("number"); | ||||
|                 BigDecimal avbbaseqty = realbalances[0].getBigDecimal("avbbaseqty"); | ||||
| 
 | ||||
|                 FWInvQueryResult.ResultBean resultBean = new FWInvQueryResult.ResultBean(); | ||||
|                 resultBean.setNumber(materialNumber); | ||||
|                 resultBean.setLot(lot); | ||||
|                 resultBean.setQty(avbbaseqty); | ||||
|                 resultBeanList.add(resultBean); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         resultExt.setFailCount(failCount); | ||||
|         resultExt.setSuccessCount(queryModels.size() - failCount); | ||||
|         resultExt.setResult(resultBeanList); | ||||
|         return CustomApiResult.success(resultExt); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -0,0 +1,52 @@ | |||
| package tqq9.lc123.cloud.app.api.model; | ||||
| 
 | ||||
| import kd.bos.openapi.common.custom.annotation.ApiModel; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiParam; | ||||
| 
 | ||||
| @ApiModel | ||||
| public class FWBillStateUpdModel { | ||||
| 
 | ||||
|     @ApiParam(value = "金蝶单据类型", example = "bd_material", required = true) | ||||
|     private String KDBillType; | ||||
| 
 | ||||
|     @ApiParam(value = "金蝶单据编码", example = "M001", required = true) | ||||
|     private String KDBillNumber; | ||||
| 
 | ||||
|     @ApiParam(value = "状态", example = "A", required = true) | ||||
|     private String state; | ||||
| 
 | ||||
|     @ApiParam(value = "说明", example = "审核通过") | ||||
|     private String message; | ||||
| 
 | ||||
|     public String getKDBillType() { | ||||
|         return KDBillType; | ||||
|     } | ||||
| 
 | ||||
|     public void setKDBillType(String KDBillType) { | ||||
|         this.KDBillType = KDBillType; | ||||
|     } | ||||
| 
 | ||||
|     public String getKDBillNumber() { | ||||
|         return KDBillNumber; | ||||
|     } | ||||
| 
 | ||||
|     public void setKDBillNumber(String KDBillNumber) { | ||||
|         this.KDBillNumber = KDBillNumber; | ||||
|     } | ||||
| 
 | ||||
|     public String getState() { | ||||
|         return state; | ||||
|     } | ||||
| 
 | ||||
|     public void setState(String state) { | ||||
|         this.state = state; | ||||
|     } | ||||
| 
 | ||||
|     public String getMessage() { | ||||
|         return message; | ||||
|     } | ||||
| 
 | ||||
|     public void setMessage(String message) { | ||||
|         this.message = message; | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,49 @@ | |||
| package tqq9.lc123.cloud.app.api.model; | ||||
| 
 | ||||
| import kd.bos.openapi.common.custom.annotation.ApiModel; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiParam; | ||||
| 
 | ||||
| import java.io.Serializable; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| @ApiModel | ||||
| public class FWInvQueryModel implements Serializable { | ||||
| 
 | ||||
|     @ApiParam(value = "物料编码集合", example = "{}", required = true) | ||||
|     private List<QueryModel> queryModels; | ||||
| 
 | ||||
|     public List<QueryModel> getQueryModels() { | ||||
|         return queryModels; | ||||
|     } | ||||
| 
 | ||||
|     public void setQueryModels(List<QueryModel> queryModels) { | ||||
|         this.queryModels = queryModels; | ||||
|     } | ||||
| 
 | ||||
|     @ApiModel | ||||
|     public static class QueryModel implements Serializable { | ||||
| 
 | ||||
|         @ApiParam(value = "物料编码", example = "WL001", required = true) | ||||
|         private String materialNumber; | ||||
| 
 | ||||
|         @ApiParam(value = "批次号", example = "20250101", required = true) | ||||
|         private String lot; | ||||
| 
 | ||||
|         public String getMaterialNumber() { | ||||
|             return materialNumber; | ||||
|         } | ||||
| 
 | ||||
|         public void setMaterialNumber(String materialNumber) { | ||||
|             this.materialNumber = materialNumber; | ||||
|         } | ||||
| 
 | ||||
|         public String getLot() { | ||||
|             return lot; | ||||
|         } | ||||
| 
 | ||||
|         public void setLot(String lot) { | ||||
|             this.lot = lot; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,84 @@ | |||
| package tqq9.lc123.cloud.app.api.result; | ||||
| 
 | ||||
| import kd.bos.openapi.common.custom.annotation.ApiModel; | ||||
| import kd.bos.openapi.common.custom.annotation.ApiParam; | ||||
| 
 | ||||
| import java.io.Serializable; | ||||
| import java.math.BigDecimal; | ||||
| import java.util.List; | ||||
| 
 | ||||
| @ApiModel | ||||
| public class FWInvQueryResult implements Serializable { | ||||
| 
 | ||||
|     @ApiParam("操作失败数量") | ||||
|     private int failCount; | ||||
| 
 | ||||
|     @ApiParam("操作成功数量") | ||||
|     private int successCount; | ||||
| 
 | ||||
|     @ApiParam("返回结果") | ||||
|     private List<ResultBean> result; | ||||
| 
 | ||||
|     public int getFailCount() { | ||||
|         return failCount; | ||||
|     } | ||||
| 
 | ||||
|     public void setFailCount(int failCount) { | ||||
|         this.failCount = failCount; | ||||
|     } | ||||
| 
 | ||||
|     public int getSuccessCount() { | ||||
|         return successCount; | ||||
|     } | ||||
| 
 | ||||
|     public void setSuccessCount(int successCount) { | ||||
|         this.successCount = successCount; | ||||
|     } | ||||
| 
 | ||||
|     public List<ResultBean> getResult() { | ||||
|         return result; | ||||
|     } | ||||
| 
 | ||||
|     public void setResult(List<ResultBean> result) { | ||||
|         this.result = result; | ||||
|     } | ||||
| 
 | ||||
|     @ApiModel | ||||
|     public static class ResultBean implements Serializable { | ||||
| 
 | ||||
|         @ApiParam("物料编码") | ||||
|         private String number; | ||||
| 
 | ||||
|         @ApiParam("批号") | ||||
|         private String lot; | ||||
| 
 | ||||
|         @ApiParam("可用库存数量") | ||||
|         private BigDecimal qty; | ||||
| 
 | ||||
|         public String getNumber() { | ||||
|             return number; | ||||
|         } | ||||
| 
 | ||||
|         public void setNumber(String number) { | ||||
|             this.number = number; | ||||
|         } | ||||
| 
 | ||||
|         public BigDecimal getQty() { | ||||
|             return qty; | ||||
|         } | ||||
| 
 | ||||
|         public void setQty(BigDecimal qty) { | ||||
|             this.qty = qty; | ||||
|         } | ||||
| 
 | ||||
|         public String getLot() { | ||||
|             return lot; | ||||
|         } | ||||
| 
 | ||||
|         public void setLot(String lot) { | ||||
|             this.lot = lot; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue