上下架读取商品名称

master
e 2019-08-22 07:53:57 +08:00
parent c4cab0c29a
commit ee389be2ce
1 changed files with 32 additions and 41 deletions

View File

@ -14,6 +14,7 @@ import javax.validation.Validator;
import com.zzjee.md.entity.MdCusEntity; import com.zzjee.md.entity.MdCusEntity;
import com.zzjee.wm.entity.WmOmQmIEntity; import com.zzjee.wm.entity.WmOmQmIEntity;
import com.zzjee.wm.page.WmOmNoticeImpnewPage;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jeecgframework.core.common.controller.BaseController; import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException; import org.jeecgframework.core.common.exception.BusinessException;
@ -612,55 +613,45 @@ public class MdGoodsController extends BaseController {
public ResponseEntity<?> xiadan(@RequestParam String mdGoodsstr, public ResponseEntity<?> xiadan(@RequestParam String mdGoodsstr,
UriComponentsBuilder uriBuilder) { // 调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. UriComponentsBuilder uriBuilder) { // 调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
MdGoodsEntity mdGoods = (MdGoodsEntity)JSONHelper.json2Object(mdGoodsstr,MdGoodsEntity.class); WmOmNoticeImpnewPage pageheader = (WmOmNoticeImpnewPage)JSONHelper.json2Object(mdGoodsstr,WmOmNoticeImpnewPage.class);
// 保存
org.jeecgframework.core.util.LogUtil
.info("===================下单成功===================");
try {
MdGoodsEntity t = systemService.get(MdGoodsEntity.class,mdGoods.getId());
List<WmOmNoticeIEntity> wmomNoticeIListnew = new ArrayList<WmOmNoticeIEntity>(); WmOmNoticeHEntity wmOmNoticeH = null;
MdGoodsEntity t = systemService.get(MdGoodsEntity.class,pageheader.getId());
WmOmNoticeIEntity wmi = new WmOmNoticeIEntity(); List<WmOmNoticeHEntity> wmomh = systemService.findByProperty(WmOmNoticeHEntity.class, "imCusCode", pageheader.getImCusCode());
wmi.setGoodsId(t.getShpBianMa()); if(wmomh!=null&&wmomh.size()>0){
MvGoodsEntity mvgoods = systemService.findUniqueByProperty( wmOmNoticeH = wmomh.get(0);
MvGoodsEntity.class, "goodsCode", wmi.getGoodsId()); }else{
if (mvgoods != null) { wmOmNoticeH = new WmOmNoticeHEntity();
wmi.setGoodsName(mvgoods.getGoodsName()); wmOmNoticeH.setCreateBy(pageheader.getCreateBy());
wmi.setGoodsUnit(mvgoods.getShlDanWei());
}
try{
wmi.setGoodsQua(mdGoods.getChZhXiang());//长度作为数量
}catch (Exception e){
}
wmomNoticeIListnew.add(wmi);
WmOmNoticeHEntity wmOmNoticeH = new WmOmNoticeHEntity();
// wmOmNoticeH.setDelvData(pageheader.getImData());
wmOmNoticeH.setOrderTypeCode("11"); wmOmNoticeH.setOrderTypeCode("11");
wmOmNoticeH.setCusCode(t.getSuoShuKeHu()); wmOmNoticeH.setCusCode(t.getSuoShuKeHu());
String noticeid = wmUtil.getNextomNoticeId(wmOmNoticeH.getOrderTypeCode()); String noticeid = wmUtil.getNextomNoticeId(wmOmNoticeH.getOrderTypeCode());
wmOmNoticeH.setOmNoticeId(noticeid); wmOmNoticeH.setOmNoticeId(noticeid);
wmOmNoticeH.setOmBeizhu(mdGoods.getKuZhXiang() );//宽作为备注 wmOmNoticeH.setImCusCode(pageheader.getImCusCode());
wmOmNoticeH.setOcusCode(mdGoods.getGaoZhXiang());// 高作为三方客户 wmOmNoticeH.setReCarno(pageheader.getReCarno());
wmOmNoticeH.setDelvAddr(mdGoods.getTiJiCm());//体积作为地址 wmOmNoticeH.setOmBeizhu(pageheader.getImBeizhu());
MdCusOtherEntity mdcusother = systemService.findUniqueByProperty(MdCusOtherEntity.class, "keHuBianMa", wmOmNoticeH.getOcusCode());
if (mdcusother != null) { systemService.save(wmOmNoticeH);
wmOmNoticeH.setOcusName(mdcusother.getZhongWenQch());
} }
// wmOmNoticeH.setImCusCode(pageheader.getImCusCode()); WmOmNoticeIEntity wmi = new WmOmNoticeIEntity();
wmOmNoticeHService.addMain(wmOmNoticeH, wmomNoticeIListnew); wmi.setGoodsId(t.getShpBianMa());
wmi.setOmNoticeId(wmOmNoticeH.getOmNoticeId());
MvGoodsEntity mvgoods = systemService.findUniqueByProperty(
MvGoodsEntity.class, "goodsCode", wmi.getGoodsId());
if (mvgoods != null) {
wmi.setGoodsName(t.getShpMingCheng());
wmi.setGoodsUnit(t.getShlDanWei());
}
wmi.setCusCode(wmOmNoticeH.getCusCode());
try{
wmi.setGoodsQua(pageheader.getGoodsQua());//
}catch (Exception e){
}
systemService.save(wmi);
D0.setErrorMsg("订单生成成功"); D0.setErrorMsg("订单生成成功");
D0.setOK(true); D0.setOK(true);
} catch (Exception e) {
e.printStackTrace();
D0.setOK(false);
}
// 按Restful约定返回204状态码, 无内容. 也可以返回200状态码. // 按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }