| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- package com.steerinfo.dil.controller;
- import com.steerinfo.dil.mapper.CommonSeq;
- import com.steerinfo.dil.model.WmspOutboundScanResult;
- import com.steerinfo.dil.service.impl.WmspOutboundResultServiceImpl;
- import com.steerinfo.dil.service.impl.WmspOutboundScanResultServiceImpl;
- import com.steerinfo.dil.util.BaseRESTfulController;
- import com.steerinfo.dil.util.DataChange;
- import com.steerinfo.framework.controller.RESTfulResult;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.math.BigDecimal;
- import java.text.ParseException;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- @RestController
- @RequestMapping("/${api.version}/wmspoutboundscanresults")
- public class WmspOutboundScanResultController extends BaseRESTfulController {
- @Autowired
- WmspOutboundScanResultServiceImpl wmspOutboundScanResultService;
- @Autowired
- CommonSeq commonSeq;
- @Autowired
- WmspOutboundResultServiceImpl wmspOutboundResultService;
- @Autowired
- WmspOutboundResultController wmspOutboundResultController;
-
- @PostMapping(value = "/insertWmspOutboundScanResult")
- public RESTfulResult insertWmspOutboundScanResult(@RequestBody(required = false) Map<String, Object> mapval){
-
- String ScanCodeText = mapval.get("ScanCodeText").toString();
- String[] tag = ScanCodeText.split("\\-");
-
- Integer loadId = (Integer)mapval.get("loadId");
-
- Integer resultId = (Integer)mapval.get("resultId");
-
- String materialCode = wmspOutboundResultService.getmaterialCode(resultId);
- Integer jh ;
- System.out.println(materialCode);
- if(materialCode.equals(tag[8])){
- System.out.println("相同");
- jh = 0;
- }else{
- System.out.println("不相同");
- jh = 1;
- }
-
- Integer wzjs = 1;
-
- Integer seqWmspOutboundScanResult = commonSeq.getSeqNumber("seq__WMSP_OUTBOUND_SCAN_RESULT");
-
- WmspOutboundScanResult wmspOutboundScanResult = new WmspOutboundScanResult();
-
- wmspOutboundScanResult.setResultId(new BigDecimal(seqWmspOutboundScanResult));
-
- wmspOutboundScanResult.setOutboundResultId(new BigDecimal(resultId));
-
- wmspOutboundScanResult.setLoadId(new BigDecimal(loadId));
-
- wmspOutboundScanResult.setResultMaterial(ScanCodeText);
-
- wmspOutboundScanResult.setResultLoadTime(new Date());
-
- wmspOutboundScanResult.setOutboundMaterialNumber(new BigDecimal(wzjs));
-
- wmspOutboundScanResult.setResultCheck(new BigDecimal(jh));
-
- Integer i = wmspOutboundScanResultService.insertSelective(wmspOutboundScanResult);
- if(i == 1){
-
- List<Map<String, Object>> list = wmspOutboundScanResultService.getResultMaterial(resultId);
-
- System.out.println(list);
- List<Map<String, Object>> Listmap = null;
- for(Map e:list ){
- String materialOnlyCode = e.get("RESULT_MATERIAL").toString();
- String[] tag1 = materialOnlyCode.split("\\-");
- Listmap = wmspOutboundScanResultService.getRmsMaterial(tag1[7]);
- }
- return success(Listmap);
- }
- return failed();
- }
-
- @PostMapping(value = "/copyWmspOutboundScanResult")
- public RESTfulResult copyWmspOutboundScanResult(@RequestBody(required = false) Map<String, Object> mapval) throws ParseException {
- String resultMaterial=mapval.get("resultMaterial")+"";
- System.out.println("In:"+resultMaterial);
- String[] items=resultMaterial.split("-");
- if(items==null || items.length<8){
- return failed("复制失败!");
- }else{
- items[7]="ManualCopy"+System.currentTimeMillis();
- resultMaterial="";
- for(String temp:items){
- resultMaterial+=temp+"-";
- }
- resultMaterial=resultMaterial.substring(0,resultMaterial.length()-1)+" ";
- System.out.println("Copy:"+resultMaterial);
- mapval.put("resultMaterial",resultMaterial);
- return wmspOutboundResultController.insertwmspOutboundScanResult(mapval);
- }
- }
-
- @PostMapping(value = "/deleteWmspOutboundScanResult")
- public RESTfulResult deleteWmspOutboundScanResult(@RequestBody(required = false) Map<String, Object> mapval){
- return success(wmspOutboundScanResultService.deleteById(DataChange.dataToBigDecimal(mapval.get("resultId"))));
- }
- @PostMapping(value = "/AddWmspOutboundScanResult")
- public RESTfulResult AddWmspOutboundScanResult(@RequestBody(required = false) Map<String, Object> mapval){
-
- String ScanCodeText = mapval.get("ScanCodeText").toString();
- String[] tag = ScanCodeText.split("\\-");
-
- Integer loadId = (Integer)mapval.get("loadId");
-
- Integer resultId = (Integer)mapval.get("resultId");
-
- String materialCode = wmspOutboundResultService.getmaterialCode(resultId);
- Integer jh ;
- System.out.println(materialCode);
- if(materialCode.equals(tag[8])){
- jh = 0;
- }else{
- jh = 1;
- }
-
- Integer seqWmspOutboundScanResult = commonSeq.getSeqNumber("seq__WMSP_OUTBOUND_SCAN_RESULT");
-
- WmspOutboundScanResult wmspOutboundScanResult = new WmspOutboundScanResult();
-
- wmspOutboundScanResult.setResultId(new BigDecimal(seqWmspOutboundScanResult));
-
- wmspOutboundScanResult.setOutboundResultId(new BigDecimal(resultId));
-
- wmspOutboundScanResult.setLoadId(new BigDecimal(loadId));
-
- wmspOutboundScanResult.setResultMaterial(ScanCodeText);
-
- wmspOutboundScanResult.setResultLoadTime(new Date());
-
- wmspOutboundScanResult.setOutboundMaterialNumber(new BigDecimal(1));
-
- wmspOutboundScanResult.setResultCheck(new BigDecimal(jh));
-
- Integer i = wmspOutboundScanResultService.insertSelective(wmspOutboundScanResult);
- if(i == 1){
-
- List<Map<String, Object>> list = wmspOutboundScanResultService.getResultMaterial(resultId);
-
- System.out.println(list);
- List<Map<String, Object>> Listmap = null;
- for(Map e:list ){
- String materialOnlyCode = e.get("RESULT_MATERIAL").toString();
- String[] tag1 = materialOnlyCode.split("\\-");
- Listmap = wmspOutboundScanResultService.getRmsMaterial(tag1[7]);
- }
- return success(Listmap);
- }
- return failed();
- }
- }
|