|  |  |  | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.Mat; | 
|---|
|  |  |  | import com.zy.asrs.entity.MatPrint; | 
|---|
|  |  |  | import com.zy.asrs.entity.OrderDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.dto.OrderDetlWithSum; | 
|---|
|  |  |  | import com.zy.asrs.entity.result.KeyValueVo; | 
|---|
|  |  |  | import com.zy.asrs.service.LocDetlService; | 
|---|
|  |  |  | import com.zy.asrs.service.MatService; | 
|---|
|  |  |  | import com.zy.asrs.utils.MatExcelListener; | 
|---|
|  |  |  | import com.zy.common.CodeRes; | 
|---|
|  |  |  | 
|---|
|  |  |  | private MatService matService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SnowflakeIdWorker snowflakeIdWorker; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlService locDetlService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/mat/auto/matnr/auth") | 
|---|
|  |  |  | public R autoMatnr(){ | 
|---|
|  |  |  | 
|---|
|  |  |  | if (mat == null) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | OrderDetl orderDetl = new OrderDetl(); | 
|---|
|  |  |  | OrderDetlWithSum orderDetl = new OrderDetlWithSum(); | 
|---|
|  |  |  | orderDetl.sync(mat); | 
|---|
|  |  |  | orderDetl.setAnfme(0.0D); | 
|---|
|  |  |  | orderDetl.setSum(locDetlService.selectSumByMatnr(mat.getMatnr())); | 
|---|
|  |  |  | return R.ok().add(orderDetl); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R getMatDataKV(@RequestParam(required = false) String condition) { | 
|---|
|  |  |  | Wrapper<Mat> wrapper = new EntityWrapper<Mat>() | 
|---|
|  |  |  | .andNew().like("matnr", condition).or().like("maktx", condition) | 
|---|
|  |  |  | .andNew().like("matnr", condition).or().like("maktx", condition).or().like("specs", condition) | 
|---|
|  |  |  | .orderBy("create_time", false); | 
|---|
|  |  |  | List<Mat> mats = matService.selectPage(new Page<>(1, 30), wrapper).getRecords(); | 
|---|
|  |  |  | List<KeyValueVo> valueVos = new ArrayList<>(); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.entity.dto; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.zy.asrs.entity.OrderDetl; | 
|---|
|  |  |  | import lombok.Data; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 包含库存总数量 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | public class OrderDetlWithSum extends OrderDetl { | 
|---|
|  |  |  | private Double sum; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> unreason(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double selectSumByMatnr(@Param("matnr") String matnr); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> unreason(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double selectSumByMatnr(String matnr); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | return this.baseMapper.unreason(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 通过物料代码获取库存总数量 | 
|---|
|  |  |  | * @param matnr | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Double selectSumByMatnr(String matnr) { | 
|---|
|  |  |  | Double aDouble = this.baseMapper.selectSumByMatnr(matnr); | 
|---|
|  |  |  | if (aDouble == null) { | 
|---|
|  |  |  | return 0.0; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | return aDouble; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public LocDetl selectItem(String locNo, String matnr, String batch) { | 
|---|
|  |  |  | 
|---|
|  |  |  | datasource: | 
|---|
|  |  |  | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 
|---|
|  |  |  | #    url: jdbc:sqlserver://10.10.10.100:1433;databasename=bfasrs | 
|---|
|  |  |  | url: jdbc:sqlserver://localhost:1433;databasename=bfasrs | 
|---|
|  |  |  | #    url: jdbc:sqlserver://localhost:1433;databasename=bfasrs | 
|---|
|  |  |  | url: jdbc:sqlserver://192.168.4.15:1433;databasename=bfasrs | 
|---|
|  |  |  | username: sa | 
|---|
|  |  |  | #    password: Zoneyung@zy56$ | 
|---|
|  |  |  | password: sa@123 | 
|---|
|  |  |  | 
|---|
|  |  |  | AND dual.count = 1 | 
|---|
|  |  |  | ORDER BY lm.modi_time ASC | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <select id="selectSumByMatnr" resultType="java.lang.Double"> | 
|---|
|  |  |  | select sum(anfme) FROM asr_loc_detl WHERE matnr = #{matnr} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|
|  |  |  | 
|---|
|  |  |  | {field: 'batch', title: '序列码', edit: true}, | 
|---|
|  |  |  | {field: 'specs', title: '规格'}, | 
|---|
|  |  |  | {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110}, | 
|---|
|  |  |  | {field: 'sum', title: '库存数量', style: 'color: red;font-weight: bold',  minWidth: 110, width: 110}, | 
|---|
|  |  |  | // {field: 'inQty', title: '已入库量',  minWidth: 100, width: 100}, | 
|---|
|  |  |  | // {field: 'unit', title: '单位', width: 80}, | 
|---|
|  |  |  | {field: 'memo', title: '备注' , edit: true}, | 
|---|