|
|
@@ -76,19 +76,19 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
|
|
|
@Autowired
|
|
|
private SaleSendItemDao saleSendItemDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private SaleSendAllDao saleSendAllDao;
|
|
|
|
|
|
@Autowired
|
|
|
private PurchaseNoticeIndexDao purchaseNoticeIndexDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private SaleSendIndexDao saleSendIndexDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private SaleSendItemVerifyDao saleSendItemVerifyDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private UserBaseInfoDao userBaseInfoDao;
|
|
|
|
|
|
@@ -104,6 +104,7 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
private CommonDao commonDao;
|
|
|
@Autowired
|
|
|
private BarLPSetingDao barLPSetingDao;
|
|
|
+
|
|
|
@Override
|
|
|
public void save(List<PurchaseNotice> notices) {
|
|
|
notices = purchaseNoticeDao.save(notices);
|
|
|
@@ -111,7 +112,8 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<PurchaseNotice> findAllByPageInfo(final PageInfo pageInfo, final String keyword, final Long fromDate, final Long endDate, final SearchFilter filter) {
|
|
|
+ public Page<PurchaseNotice> findAllByPageInfo(final PageInfo pageInfo, final String keyword, final Long fromDate,
|
|
|
+ final Long endDate, final SearchFilter filter) {
|
|
|
return purchaseNoticeDao.findAll(new Specification<PurchaseNotice>() {
|
|
|
@Override
|
|
|
public Predicate toPredicate(Root<PurchaseNotice> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
|
@@ -120,34 +122,36 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
pageInfo.expression(PredicateUtils.in("enUU", filter.getDistribute(), false));
|
|
|
}
|
|
|
if (StringUtils.hasText(keyword))
|
|
|
- pageInfo.expression(PredicateUtils.in("id",
|
|
|
- purchaseNoticeIndexDao.findByKeyword(SystemSession.getUser().getEnterprise().getUu(), keyword), false));
|
|
|
+ pageInfo.expression(PredicateUtils.in("id", purchaseNoticeIndexDao.findByKeyword(SystemSession
|
|
|
+ .getUser().getEnterprise().getUu(), keyword), false));
|
|
|
if (fromDate != null)
|
|
|
pageInfo.expression(PredicateUtils.in("id", purchaseNoticeDao.findByFromDate(SystemSession
|
|
|
.getUser().getEnterprise().getUu(), new Date(fromDate)), false));
|
|
|
- if(endDate != null)
|
|
|
- pageInfo.expression(PredicateUtils.in("id", purchaseNoticeDao.findByEndDate(SystemSession
|
|
|
- .getUser().getEnterprise().getUu(), new Date(endDate)), false));
|
|
|
+ if (endDate != null)
|
|
|
+ pageInfo.expression(PredicateUtils.in("id", purchaseNoticeDao.findByEndDate(SystemSession.getUser()
|
|
|
+ .getEnterprise().getUu(), new Date(endDate)), false));
|
|
|
return query.where(pageInfo.getPredicates(root, query, builder)).getRestriction();
|
|
|
}
|
|
|
}, pageInfo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<PurchaseNotice> findDoneByPageInfo(final PageInfo pageInfo, final String keyword, final Long fromDate, final Long endDate) {
|
|
|
+ public Page<PurchaseNotice> findDoneByPageInfo(final PageInfo pageInfo, final String keyword, final Long fromDate,
|
|
|
+ final Long endDate) {
|
|
|
return purchaseNoticeDao.findAll(new Specification<PurchaseNotice>() {
|
|
|
public Predicate toPredicate(Root<PurchaseNotice> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
|
pageInfo.filter("status", Status.REPLIED.value());
|
|
|
- pageInfo.expression(PredicateUtils.or(PredicateUtils.isNull("end"), PredicateUtils.ne("end", Constant.YES, false)));
|
|
|
+ pageInfo.expression(PredicateUtils.or(PredicateUtils.isNull("end"),
|
|
|
+ PredicateUtils.ne("end", Constant.YES, false)));
|
|
|
if (StringUtils.hasText(keyword))
|
|
|
- pageInfo.expression(PredicateUtils.in("id",
|
|
|
- purchaseNoticeIndexDao.findByKeyword(SystemSession.getUser().getEnterprise().getUu(), keyword), false));
|
|
|
+ pageInfo.expression(PredicateUtils.in("id", purchaseNoticeIndexDao.findByKeyword(SystemSession
|
|
|
+ .getUser().getEnterprise().getUu(), keyword), false));
|
|
|
if (fromDate != null)
|
|
|
pageInfo.expression(PredicateUtils.in("id", purchaseNoticeDao.findByFromDate(SystemSession
|
|
|
.getUser().getEnterprise().getUu(), new Date(fromDate)), false));
|
|
|
- if(endDate != null)
|
|
|
- pageInfo.expression(PredicateUtils.in("id", purchaseNoticeDao.findByEndDate(SystemSession
|
|
|
- .getUser().getEnterprise().getUu(), new Date(endDate)), false));
|
|
|
+ if (endDate != null)
|
|
|
+ pageInfo.expression(PredicateUtils.in("id", purchaseNoticeDao.findByEndDate(SystemSession.getUser()
|
|
|
+ .getEnterprise().getUu(), new Date(endDate)), false));
|
|
|
return query.where(pageInfo.getPredicates(root, query, builder)).getRestriction();
|
|
|
}
|
|
|
}, pageInfo);
|
|
|
@@ -191,12 +195,14 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
|
|
|
@Override
|
|
|
public List<SaleSend> findNotUploadSend() {
|
|
|
- return saleSendDao.findByCustUUAndSendStatus(SystemSession.getUser().getEnterprise().getUu(), (short) Status.NOT_UPLOAD.value());
|
|
|
+ return saleSendDao.findByCustUUAndSendStatus(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
+ (short) Status.NOT_UPLOAD.value());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<SaleSend> findNotSendSend() {
|
|
|
- return saleSendDao.findByEnUUAndBackStatus(SystemSession.getUser().getEnterprise().getUu(), (short) Status.NOT_UPLOAD.value());
|
|
|
+ return saleSendDao.findByEnUUAndBackStatus(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
+ (short) Status.NOT_UPLOAD.value());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -235,8 +241,7 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
Long vendUserUU = notice.getOrderItem().getOrder().getVendUserUU();
|
|
|
if (vendUserUU != null) {
|
|
|
UserBaseInfo user = userBaseInfoDao.findOne(vendUserUU);
|
|
|
- XingePusher.pushByUser(user, "客户取消了送货提醒", "物料:"
|
|
|
- + notice.getOrderItem().getProduct().getTitle(),
|
|
|
+ XingePusher.pushByUser(user, "客户取消了送货提醒", "物料:" + notice.getOrderItem().getProduct().getTitle(),
|
|
|
"", "");
|
|
|
}
|
|
|
}
|
|
|
@@ -264,9 +269,12 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
public SaleSend send(Long noticeId, SaleSend send) {
|
|
|
PurchaseNotice notice = purchaseNoticeDao.findOne(noticeId);
|
|
|
// //限制同一个供应商发货单号不可以重复,(限制被去掉 -- 2015年6月5日15:23:52)
|
|
|
- // List<SaleSend> saleSend = saleSendDao.findByEnUUAndCode(SystemSession.getUser().getEnterprise().getUu(), send.getCode());
|
|
|
+ // List<SaleSend> saleSend =
|
|
|
+ // saleSendDao.findByEnUUAndCode(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
+ // send.getCode());
|
|
|
// if (saleSend.size() > 0)
|
|
|
- // throw new IllegalOperatorException("发货单号重复,无法发货!提示:多个物料一起发货请选择批量发货。");
|
|
|
+ // throw new
|
|
|
+ // IllegalOperatorException("发货单号重复,无法发货!提示:多个物料一起发货请选择批量发货。");
|
|
|
if (notice != null) {
|
|
|
if (notice.getEnd() != null && notice.getEnd() == Constant.YES)
|
|
|
throw new IllegalOperatorException("客户已经取消了本次送货提醒,请刷新重试!");
|
|
|
@@ -280,7 +288,7 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
send.setCurrency(order.getCurrency());
|
|
|
send.setBackStatus((short) Status.NOT_UPLOAD.value());
|
|
|
send.setSendStatus((short) Status.NOT_UPLOAD.value());
|
|
|
- send.setVerifystatus(Constant.NO);//未收料
|
|
|
+ send.setVerifystatus(Constant.NO);// 未收料
|
|
|
send.setCustUU(notice.getEnUU());
|
|
|
send.setCustUserUU(order.getUserUU());
|
|
|
send.setDate(new Date());
|
|
|
@@ -323,37 +331,41 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
public SaleSend send(SaleSend saleSend) {
|
|
|
if (saleSend != null) {
|
|
|
// //限制同一个供应商发货单号不可以重复,(限制被去掉 -- 2015年6月5日15:23:52)
|
|
|
- // List<SaleSend> saleSends = saleSendDao.findByEnUUAndCode(SystemSession.getUser().getEnterprise().getUu(), saleSend.getCode());
|
|
|
+ // List<SaleSend> saleSends =
|
|
|
+ // saleSendDao.findByEnUUAndCode(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
+ // saleSend.getCode());
|
|
|
// if (saleSends.size() > 0)
|
|
|
- // throw new IllegalOperatorException("发货单号重复,无法发货!提示:多个物料一起发货请选择批量发货。");
|
|
|
+ // throw new
|
|
|
+ // IllegalOperatorException("发货单号重复,无法发货!提示:多个物料一起发货请选择批量发货。");
|
|
|
saleSend.setBackStatus((short) Status.NOT_UPLOAD.value());
|
|
|
saleSend.setSendStatus((short) Status.NOT_UPLOAD.value());
|
|
|
saleSend.setEnUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
saleSend.setRecorder(SystemSession.getUser().getUserName());
|
|
|
saleSend.setDate(new Date());
|
|
|
- saleSend.setVerifystatus(Constant.NO);//未收料
|
|
|
+ saleSend.setVerifystatus(Constant.NO);// 未收料
|
|
|
short number = 0;
|
|
|
List<SaleSendItem> sendItems = new ArrayList<SaleSendItem>();
|
|
|
for (SaleSendItem item : saleSend.getSendItems()) {
|
|
|
PurchaseNotice notice = purchaseNoticeDao.findOne(item.getNoticeId());
|
|
|
if (notice != null) {
|
|
|
- if(notice.getEnd() != null && notice.getEnd() == Constant.YES){
|
|
|
- String error ="货车中订单:"+notice.getOrderItem().getOrder().getCode()+ "的物料号为" + notice.getOrderItem().getProduct().getCode() +"的发货通知被取消!" ;
|
|
|
- throw new IllegalOperatorException(error);
|
|
|
- }else{
|
|
|
- double thisQty = item.getQty();
|
|
|
- double endQty = (notice.getEndQty() == null ? 0.0 : notice.getEndQty()) + thisQty;
|
|
|
- if (endQty > notice.getQty())
|
|
|
- throw new IllegalOperatorException("累计发货数量将超出本次送货提醒的需求数!");
|
|
|
- item.setNotice(notice);
|
|
|
- if(item.getNumber() == null || item.getNumber() == 0) {// 带了序号则不重设序号,不带这重设序号
|
|
|
- item.setNumber(++number);
|
|
|
- }
|
|
|
- item.setOrderItem(notice.getOrderItem());
|
|
|
- item.setOrderItemId(notice.getOrderItemId());
|
|
|
- saleSend.setRate(notice.getOrderItem().getOrder().getRate());
|
|
|
- item.setSend(saleSend);
|
|
|
- sendItems.add(item);
|
|
|
+ if (notice.getEnd() != null && notice.getEnd() == Constant.YES) {
|
|
|
+ String error = "货车中订单:" + notice.getOrderItem().getOrder().getCode() + "的物料号为"
|
|
|
+ + notice.getOrderItem().getProduct().getCode() + "的发货通知被取消!";
|
|
|
+ throw new IllegalOperatorException(error);
|
|
|
+ } else {
|
|
|
+ double thisQty = item.getQty();
|
|
|
+ double endQty = (notice.getEndQty() == null ? 0.0 : notice.getEndQty()) + thisQty;
|
|
|
+ if (endQty > notice.getQty())
|
|
|
+ throw new IllegalOperatorException("累计发货数量将超出本次送货提醒的需求数!");
|
|
|
+ item.setNotice(notice);
|
|
|
+ if (item.getNumber() == null || item.getNumber() == 0) {// 带了序号则不重设序号,不带这重设序号
|
|
|
+ item.setNumber(++number);
|
|
|
+ }
|
|
|
+ item.setOrderItem(notice.getOrderItem());
|
|
|
+ item.setOrderItemId(notice.getOrderItemId());
|
|
|
+ saleSend.setRate(notice.getOrderItem().getOrder().getRate());
|
|
|
+ item.setSend(saleSend);
|
|
|
+ sendItems.add(item);
|
|
|
}
|
|
|
} else {
|
|
|
throw new IllegalOperatorException("参数错误,无效的客户送货提醒单!");
|
|
|
@@ -380,7 +392,8 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<SaleSendAll> findSendsByPageInfo(final PageInfo pageInfo, final String keyword, final Long fromDate, final Long endDate, final SearchFilter filter) {
|
|
|
+ public Page<SaleSendAll> findSendsByPageInfo(final PageInfo pageInfo, final String keyword, final Long fromDate,
|
|
|
+ final Long endDate, final SearchFilter filter) {
|
|
|
return saleSendAllDao.findAll(new Specification<SaleSendAll>() {
|
|
|
@Override
|
|
|
public Predicate toPredicate(Root<SaleSendAll> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
|
@@ -390,13 +403,14 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
}
|
|
|
if (StringUtils.hasText(keyword))
|
|
|
pageInfo.expression(PredicateUtils.in("id",
|
|
|
- saleSendIndexDao.findByKeyword(SystemSession.getUser().getEnterprise().getUu(), keyword), false));
|
|
|
+ saleSendIndexDao.findByKeyword(SystemSession.getUser().getEnterprise().getUu(), keyword),
|
|
|
+ false));
|
|
|
if (fromDate != null)
|
|
|
- pageInfo.expression(PredicateUtils.in("id", saleSendAllDao.findByFromDate(SystemSession
|
|
|
- .getUser().getEnterprise().getUu(), new Date(fromDate)), false));
|
|
|
- if(endDate != null)
|
|
|
- pageInfo.expression(PredicateUtils.in("id", saleSendAllDao.findByEndDate(SystemSession
|
|
|
- .getUser().getEnterprise().getUu(), new Date(endDate)), false));
|
|
|
+ pageInfo.expression(PredicateUtils.in("id", saleSendAllDao.findByFromDate(SystemSession.getUser()
|
|
|
+ .getEnterprise().getUu(), new Date(fromDate)), false));
|
|
|
+ if (endDate != null)
|
|
|
+ pageInfo.expression(PredicateUtils.in("id", saleSendAllDao.findByEndDate(SystemSession.getUser()
|
|
|
+ .getEnterprise().getUu(), new Date(endDate)), false));
|
|
|
return query.where(pageInfo.getPredicates(root, query, builder)).getRestriction();
|
|
|
}
|
|
|
}, pageInfo);
|
|
|
@@ -417,9 +431,8 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
public void onVerify(List<SaleSendItemVerify> verifies) {
|
|
|
- saleSendItemVerifyDao.save(verifies);
|
|
|
+ verifies = saleSendItemVerifyDao.save(verifies);
|
|
|
for (SaleSendItemVerify verify : verifies) {
|
|
|
saleSendItemDao.updateByVerify(verify.getSendItemId());
|
|
|
updateVerifyStatus(verify.getSendItemId());
|
|
|
@@ -427,7 +440,6 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
public void unVerify(List<SaleSendItemVerify> verifies) {
|
|
|
saleSendItemVerifyDao.delete(verifies);
|
|
|
for (SaleSendItemVerify verify : verifies) {
|
|
|
@@ -435,16 +447,17 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
updateVerifyStatus(verify.getSendItemId());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 更新发货单的收料状态
|
|
|
+ *
|
|
|
* @param sendItemId
|
|
|
*/
|
|
|
private void updateVerifyStatus(Long sendItemId) {
|
|
|
SaleSendItem sendItem = saleSendItemDao.findOne(sendItemId);
|
|
|
int totalCount = saleSendItemDao.getTotalCountBySendId(sendItem.getSend().getId());
|
|
|
int verifyCount = saleSendItemDao.getFullVerifyCountBySendId(sendItem.getSend().getId());
|
|
|
- if(verifyCount == totalCount)
|
|
|
+ if (verifyCount == totalCount)
|
|
|
sendItem.getSend().setVerifystatus(Constant.YES);
|
|
|
else
|
|
|
sendItem.getSend().setVerifystatus(Constant.NO);
|
|
|
@@ -454,11 +467,11 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
@Override
|
|
|
public SaleSendAll findSaleSendById(Long id) {
|
|
|
SaleSendAll send = saleSendAllDao.findOne(id);
|
|
|
- if(send == null)
|
|
|
+ if (send == null)
|
|
|
throw new IllegalOperatorException("您查找的发货单不存在!");
|
|
|
return send;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public Long getAllCount() {
|
|
|
return purchaseNoticeDao.countByVendUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
@@ -485,70 +498,72 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateBarCode(Long id ,Double packageQty, Double outBoxQty) {
|
|
|
+ public void updateBarCode(Long id, Double packageQty, Double outBoxQty) {
|
|
|
saleSendItemDao.updatePackageQty(id, packageQty, outBoxQty);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void generateBarcodes(Long id,List<SaleSendItem> sendItem,Long enUU) {
|
|
|
+ public void generateBarcodes(Long id, List<SaleSendItem> sendItem, Long enUU) {
|
|
|
SaleSend saleSend = saleSendDao.findOne(id);
|
|
|
Long custUU = saleSend.getCustUU();
|
|
|
- //获取条码生成规则,判断规则是否审核,已审核,根据规则拼接
|
|
|
- B2bCodeSet barcodeSet = b2bCodeSetDao.findByEnUUAndType(custUU,"BATCH");
|
|
|
- if(barcodeSet != null){//条码生成规则不为空,已审核
|
|
|
- if(!barcodeSet.getStatuscode().equals("AUDITED")){
|
|
|
+ // 获取条码生成规则,判断规则是否审核,已审核,根据规则拼接
|
|
|
+ B2bCodeSet barcodeSet = b2bCodeSetDao.findByEnUUAndType(custUU, "BATCH");
|
|
|
+ if (barcodeSet != null) {// 条码生成规则不为空,已审核
|
|
|
+ if (!barcodeSet.getStatuscode().equals("AUDITED")) {
|
|
|
throw new IllegalOperatorException("请先审核条码生成规则!");
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
throw new IllegalOperatorException("请先维护条码生成规则!");
|
|
|
}
|
|
|
- //是否维护包装箱生成规则
|
|
|
- B2bCodeSet outboxSet = b2bCodeSetDao.findByEnUUAndType(custUU,"PACK");
|
|
|
- if(outboxSet == null){
|
|
|
+ // 是否维护包装箱生成规则
|
|
|
+ B2bCodeSet outboxSet = b2bCodeSetDao.findByEnUUAndType(custUU, "PACK");
|
|
|
+ if (outboxSet == null) {
|
|
|
throw new IllegalOperatorException("请先维护外箱生成规则!");
|
|
|
}
|
|
|
- if(!outboxSet.getStatuscode().equals("AUDITED")){
|
|
|
+ if (!outboxSet.getStatuscode().equals("AUDITED")) {
|
|
|
throw new IllegalOperatorException("请先审核外箱生成规则!");
|
|
|
- }
|
|
|
- for(SaleSendItem item :sendItem){
|
|
|
- //清空原有箱号,箱号明细,条码
|
|
|
+ }
|
|
|
+ for (SaleSendItem item : sendItem) {
|
|
|
+ // 清空原有箱号,箱号明细,条码
|
|
|
List<BarSendNotify> bsNotify = barSendNotifyDao.findBySiid(item.getId());
|
|
|
- for(BarSendNotify notify:bsNotify){
|
|
|
- if(notify.getOutboxid() != null){
|
|
|
- BarPackage barPackage = barPackageDao.findOne(notify.getOutboxid());
|
|
|
- if(barPackage != null){
|
|
|
+ for (BarSendNotify notify : bsNotify) {
|
|
|
+ if (notify.getOutboxid() != null) {
|
|
|
+ BarPackage barPackage = barPackageDao.findOne(notify.getOutboxid());
|
|
|
+ if (barPackage != null) {
|
|
|
barPackageDetailDao.delete(barPackage.getDetail());
|
|
|
barPackageDao.delete(barPackage);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
barSendNotifyDao.deleteAllBySiid(item.getId());
|
|
|
- //logger.log("发货单", "清除条码", "清除发货单:"+sitem.getSend().getCode()+",明细行序号:"+sitem.getNumber()+",所有条码!");
|
|
|
- //获取明细,最小包装数,外箱容量等信息
|
|
|
+ // logger.log("发货单", "清除条码",
|
|
|
+ // "清除发货单:"+sitem.getSend().getCode()+",明细行序号:"+sitem.getNumber()+",所有条码!");
|
|
|
+ // 获取明细,最小包装数,外箱容量等信息
|
|
|
SaleSendItem sItem = saleSendItemDao.findOne(item.getId());
|
|
|
- double pQty = sItem.getPackageQty(), bQty = sItem.getOutBoxQty(),
|
|
|
- qty = sItem.getQty();
|
|
|
+ double pQty = sItem.getPackageQty(), bQty = sItem.getOutBoxQty(), qty = sItem.getQty();
|
|
|
String bar_code, pr_code = sItem.getOrderItem().getProduct().getCode();
|
|
|
- int aNum = (int) (qty/pQty);//最小包装数件数
|
|
|
- double aqtyA = (new BigDecimal(Double.toString(qty))).subtract(new BigDecimal(Double.toString(aNum*pQty))).doubleValue(); //小于最小包装数的
|
|
|
- String sourceId = String.valueOf(sItem.getOrderItem().getProduct().getSourceId());//ERP中对应的物料ID
|
|
|
- //获取是否勾选了生成外箱
|
|
|
- if(item.getIsOutboxChecked()){//勾选了生成外箱
|
|
|
- //判断外箱容量是否为最小包装数的整数倍
|
|
|
+ int aNum = (int) (qty / pQty);// 最小包装数件数
|
|
|
+ double aqtyA = (new BigDecimal(Double.toString(qty)))
|
|
|
+ .subtract(new BigDecimal(Double.toString(aNum * pQty))).doubleValue(); // 小于最小包装数的
|
|
|
+ String sourceId = String.valueOf(sItem.getOrderItem().getProduct().getSourceId());// ERP中对应的物料ID
|
|
|
+ // 获取是否勾选了生成外箱
|
|
|
+ if (item.getIsOutboxChecked()) {// 勾选了生成外箱
|
|
|
+ // 判断外箱容量是否为最小包装数的整数倍
|
|
|
String out_boxcode = null;
|
|
|
- Long pa_id = null;
|
|
|
- int sumJ = (int) (bQty/pQty);//每箱件数
|
|
|
- if(sumJ*pQty != bQty){
|
|
|
- throw new IllegalOperatorException("序号:"+sItem.getNumber()+",外箱容量不是最小包装数的整数倍!");
|
|
|
+ Long pa_id = null;
|
|
|
+ int sumJ = (int) (bQty / pQty);// 每箱件数
|
|
|
+ if (sumJ * pQty != bQty) {
|
|
|
+ throw new IllegalOperatorException("序号:" + sItem.getNumber() + ",外箱容量不是最小包装数的整数倍!");
|
|
|
}
|
|
|
- int bNum = (int) (qty/bQty); //整数箱数
|
|
|
- double bqtyB = (new BigDecimal(Double.toString(qty))).subtract(new BigDecimal(Double.toString(bNum*bQty))).doubleValue(); //零散数
|
|
|
- if (aNum >= 1){
|
|
|
- for (int i = 0;i < aNum;i++){
|
|
|
- if(i%sumJ == 0){
|
|
|
- BarPackage barPackage = new BarPackage();
|
|
|
- out_boxcode = outboxMethod(sourceId, outboxSet);
|
|
|
+ int bNum = (int) (qty / bQty); // 整数箱数
|
|
|
+ double bqtyB = (new BigDecimal(Double.toString(qty))).subtract(
|
|
|
+ new BigDecimal(Double.toString(bNum * bQty))).doubleValue(); // 零散数
|
|
|
+ if (aNum >= 1) {
|
|
|
+ for (int i = 0; i < aNum; i++) {
|
|
|
+ if (i % sumJ == 0) {
|
|
|
+ BarPackage barPackage = new BarPackage();
|
|
|
+ out_boxcode = outboxMethod(sourceId, outboxSet);
|
|
|
barPackage.setCustUU(custUU);
|
|
|
barPackage.setEnUU(enUU);
|
|
|
barPackage.setOutboxcode(out_boxcode);
|
|
|
@@ -556,116 +571,119 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
barPackage.setLevel((long) 1);
|
|
|
barPackage.setPackdate(new Date());
|
|
|
barPackage.setSendStatus((short) Status.NOT_UPLOAD.value());
|
|
|
- if(i >= aNum-sumJ && bqtyB>0 ){
|
|
|
- barPackage.setPackageqty(aNum-sumJ);
|
|
|
- barPackage.setTotalqty(bqtyB);
|
|
|
- }else{
|
|
|
+ if (i >= aNum - sumJ && bqtyB > 0) {
|
|
|
+ barPackage.setPackageqty(aNum - sumJ);
|
|
|
+ barPackage.setTotalqty(bqtyB);
|
|
|
+ } else {
|
|
|
barPackage.setPackageqty(sumJ);
|
|
|
- barPackage.setTotalqty(bQty);
|
|
|
+ barPackage.setTotalqty(bQty);
|
|
|
}
|
|
|
barPackageDao.save(barPackage);
|
|
|
barPackage = barPackageDao.findByOutboxcodeAndEnUU(out_boxcode, enUU);
|
|
|
pa_id = barPackage.getId();
|
|
|
- }
|
|
|
- bar_code = barcodeMethod(sourceId,barcodeSet);
|
|
|
- insertBarPd(pa_id,out_boxcode,pQty,bar_code,sItem,enUU);
|
|
|
+ }
|
|
|
+ bar_code = barcodeMethod(sourceId, barcodeSet);
|
|
|
+ insertBarPd(pa_id, out_boxcode, pQty, bar_code, sItem, enUU);
|
|
|
}
|
|
|
}
|
|
|
- if(aqtyA>0){
|
|
|
- bar_code = barcodeMethod(sourceId,barcodeSet);
|
|
|
- insertBarPd(pa_id,out_boxcode,aqtyA,bar_code,sItem,enUU);
|
|
|
- }
|
|
|
- logger.log("发货单", "生成条码和箱号", "发货单:"+sItem.getSend().getCode()+",明细行序号:"+sItem.getNumber()+",生成条码和箱号!");
|
|
|
- }else{
|
|
|
- if (aNum >= 1){
|
|
|
- for (int i = 0;i < aNum;i++){
|
|
|
- insertBar(sItem,pQty,enUU,barcodeSet);
|
|
|
+ if (aqtyA > 0) {
|
|
|
+ bar_code = barcodeMethod(sourceId, barcodeSet);
|
|
|
+ insertBarPd(pa_id, out_boxcode, aqtyA, bar_code, sItem, enUU);
|
|
|
+ }
|
|
|
+ logger.log("发货单", "生成条码和箱号", "发货单:" + sItem.getSend().getCode() + ",明细行序号:" + sItem.getNumber()
|
|
|
+ + ",生成条码和箱号!");
|
|
|
+ } else {
|
|
|
+ if (aNum >= 1) {
|
|
|
+ for (int i = 0; i < aNum; i++) {
|
|
|
+ insertBar(sItem, pQty, enUU, barcodeSet);
|
|
|
}
|
|
|
}
|
|
|
- if(aqtyA > 0){
|
|
|
- insertBar(sItem,aqtyA,enUU,barcodeSet);
|
|
|
+ if (aqtyA > 0) {
|
|
|
+ insertBar(sItem, aqtyA, enUU, barcodeSet);
|
|
|
}
|
|
|
- logger.log("发货单", "生成条码", "发货单:"+sItem.getSend().getCode()+",明细行序号:"+sItem.getNumber()+",生成条码!");
|
|
|
+ logger.log("发货单", "生成条码", "发货单:" + sItem.getSend().getCode() + ",明细行序号:" + sItem.getNumber() + ",生成条码!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- private String lpad(int length, String number) {
|
|
|
- while (number.length() < length) {
|
|
|
- number = "0" + number;
|
|
|
- }
|
|
|
- number = number.substring(number.length()-length, number.length());
|
|
|
- return number;
|
|
|
- }
|
|
|
- //生成条码号
|
|
|
- public String barcodeMethod(String pr_id,B2bCodeSet barcodeSet) {
|
|
|
+
|
|
|
+ private String lpad(int length, String number) {
|
|
|
+ while (number.length() < length) {
|
|
|
+ number = "0" + number;
|
|
|
+ }
|
|
|
+ number = number.substring(number.length() - length, number.length());
|
|
|
+ return number;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成条码号
|
|
|
+ public String barcodeMethod(String pr_id, B2bCodeSet barcodeSet) {
|
|
|
StringBuffer code = new StringBuffer();
|
|
|
String date = "0";
|
|
|
- String formPlat = barcodeSet.getFromplat(), dataStr = barcodeSet.getDatestr(),
|
|
|
- maxdate = barcodeSet.getMaxdate();
|
|
|
- int lennum = barcodeSet.getLennum().intValue(), maxnum = barcodeSet.getMaxnum().intValue(),
|
|
|
- lenprid =barcodeSet.getLenprid().intValue();
|
|
|
- //拼接
|
|
|
- code.append(formPlat);//平台标识
|
|
|
- code.append(lpad(lenprid,pr_id));//PR_ID物料ID的长度
|
|
|
- if(dataStr.equals("YYMMDD")){//日期
|
|
|
- SimpleDateFormat YMD = new SimpleDateFormat("yyMMdd");
|
|
|
- date = YMD.format(new Date());
|
|
|
- }else if(dataStr.equals("YYMM")){
|
|
|
- SimpleDateFormat YM = new SimpleDateFormat("yyMM");
|
|
|
+ String formPlat = barcodeSet.getFromplat(), dataStr = barcodeSet.getDatestr(), maxdate = barcodeSet
|
|
|
+ .getMaxdate();
|
|
|
+ int lennum = barcodeSet.getLennum().intValue(), maxnum = barcodeSet.getMaxnum().intValue(), lenprid = barcodeSet
|
|
|
+ .getLenprid().intValue();
|
|
|
+ // 拼接
|
|
|
+ code.append(formPlat);// 平台标识
|
|
|
+ code.append(lpad(lenprid, pr_id));// PR_ID物料ID的长度
|
|
|
+ if (dataStr.equals("YYMMDD")) {// 日期
|
|
|
+ SimpleDateFormat YMD = new SimpleDateFormat("yyMMdd");
|
|
|
+ date = YMD.format(new Date());
|
|
|
+ } else if (dataStr.equals("YYMM")) {
|
|
|
+ SimpleDateFormat YM = new SimpleDateFormat("yyMM");
|
|
|
date = YM.format(new Date());
|
|
|
- }else if (dataStr.equals("MMDD")){
|
|
|
- SimpleDateFormat MD = new SimpleDateFormat("MMdd");
|
|
|
- date = MD.format(new Date());
|
|
|
- }
|
|
|
- code.append(date);//日期
|
|
|
- barcodeSet.setMaxdate(date);
|
|
|
- if(!("").equals(maxdate)&& null != maxdate && (!date.equals("0"))&&(Integer.valueOf(maxdate)> Integer.valueOf(date))){//如果当前日期大于上次日期
|
|
|
- code.append(lpad(lennum,"1"));//流水重新开始
|
|
|
- barcodeSet.setMaxnum((long) 2);//流水号增加1
|
|
|
- }else{
|
|
|
- code.append(lpad(lennum,String.valueOf(maxnum)));//当前流水号
|
|
|
- barcodeSet.setMaxnum((long) (maxnum+1));//流水号增加1
|
|
|
- }
|
|
|
+ } else if (dataStr.equals("MMDD")) {
|
|
|
+ SimpleDateFormat MD = new SimpleDateFormat("MMdd");
|
|
|
+ date = MD.format(new Date());
|
|
|
+ }
|
|
|
+ code.append(date);// 日期
|
|
|
+ barcodeSet.setMaxdate(date);
|
|
|
+ if (!("").equals(maxdate) && null != maxdate && (!date.equals("0"))
|
|
|
+ && (Integer.valueOf(maxdate) > Integer.valueOf(date))) {// 如果当前日期大于上次日期
|
|
|
+ code.append(lpad(lennum, "1"));// 流水重新开始
|
|
|
+ barcodeSet.setMaxnum((long) 2);// 流水号增加1
|
|
|
+ } else {
|
|
|
+ code.append(lpad(lennum, String.valueOf(maxnum)));// 当前流水号
|
|
|
+ barcodeSet.setMaxnum((long) (maxnum + 1));// 流水号增加1
|
|
|
+ }
|
|
|
b2bCodeSetDao.save(barcodeSet);
|
|
|
return code.toString();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- //生成外箱号
|
|
|
- public String outboxMethod(String pr_id,B2bCodeSet barcodeSet) {
|
|
|
+ // 生成外箱号
|
|
|
+ public String outboxMethod(String pr_id, B2bCodeSet barcodeSet) {
|
|
|
StringBuffer code = new StringBuffer();
|
|
|
String date = "0";
|
|
|
- String formPlat = barcodeSet.getFromplat(), dataStr = barcodeSet.getDatestr(),
|
|
|
- maxdate = barcodeSet.getMaxdate();
|
|
|
- int lennum = barcodeSet.getLennum().intValue(), maxnum = barcodeSet.getMaxnum().intValue(),
|
|
|
- lenprid =barcodeSet.getLenprid().intValue();
|
|
|
- code.append(formPlat);//平台标识
|
|
|
- code.append(lpad(lenprid,pr_id));//PR_ID物料ID的长度
|
|
|
- if(dataStr.equals("YYMMDD")){
|
|
|
- SimpleDateFormat YMD = new SimpleDateFormat("yyMMdd");
|
|
|
- date = YMD.format(new Date());
|
|
|
- }else if(dataStr.equals("YYMM")){
|
|
|
- SimpleDateFormat YM = new SimpleDateFormat("yyMM");
|
|
|
+ String formPlat = barcodeSet.getFromplat(), dataStr = barcodeSet.getDatestr(), maxdate = barcodeSet
|
|
|
+ .getMaxdate();
|
|
|
+ int lennum = barcodeSet.getLennum().intValue(), maxnum = barcodeSet.getMaxnum().intValue(), lenprid = barcodeSet
|
|
|
+ .getLenprid().intValue();
|
|
|
+ code.append(formPlat);// 平台标识
|
|
|
+ code.append(lpad(lenprid, pr_id));// PR_ID物料ID的长度
|
|
|
+ if (dataStr.equals("YYMMDD")) {
|
|
|
+ SimpleDateFormat YMD = new SimpleDateFormat("yyMMdd");
|
|
|
+ date = YMD.format(new Date());
|
|
|
+ } else if (dataStr.equals("YYMM")) {
|
|
|
+ SimpleDateFormat YM = new SimpleDateFormat("yyMM");
|
|
|
date = YM.format(new Date());
|
|
|
- }else if (dataStr.equals("MMDD")){
|
|
|
- SimpleDateFormat MD = new SimpleDateFormat("MMdd");
|
|
|
+ } else if (dataStr.equals("MMDD")) {
|
|
|
+ SimpleDateFormat MD = new SimpleDateFormat("MMdd");
|
|
|
date = MD.format(new Date());
|
|
|
- }
|
|
|
- code.append(date);//日期
|
|
|
+ }
|
|
|
+ code.append(date);// 日期
|
|
|
barcodeSet.setMaxdate(date);
|
|
|
- if(!("").equals(maxdate)&& null != maxdate && (!date.equals("0"))&&(Integer.valueOf(maxdate)> Integer.valueOf(date))){//如果当前日期大于上次日期
|
|
|
- code.append(lpad(lennum,"1"));//流水重新开始
|
|
|
- barcodeSet.setMaxnum((long) 2);//流水号增加1
|
|
|
- }else{
|
|
|
- code.append(lpad(lennum,String.valueOf(maxnum)));//当前流水号
|
|
|
- barcodeSet.setMaxnum((long) (maxnum+1));//流水号增加1
|
|
|
- }
|
|
|
+ if (!("").equals(maxdate) && null != maxdate && (!date.equals("0"))
|
|
|
+ && (Integer.valueOf(maxdate) > Integer.valueOf(date))) {// 如果当前日期大于上次日期
|
|
|
+ code.append(lpad(lennum, "1"));// 流水重新开始
|
|
|
+ barcodeSet.setMaxnum((long) 2);// 流水号增加1
|
|
|
+ } else {
|
|
|
+ code.append(lpad(lennum, String.valueOf(maxnum)));// 当前流水号
|
|
|
+ barcodeSet.setMaxnum((long) (maxnum + 1));// 流水号增加1
|
|
|
+ }
|
|
|
b2bCodeSetDao.save(barcodeSet);
|
|
|
return code.toString();
|
|
|
}
|
|
|
|
|
|
- private void insertBarPd(Long pa_id,String out_boxcode,double qty,String bar_code,SaleSendItem sItem,Long enUU){
|
|
|
+ private void insertBarPd(Long pa_id, String out_boxcode, double qty, String bar_code, SaleSendItem sItem, Long enUU) {
|
|
|
BarSendNotify barSendNotify = new BarSendNotify();
|
|
|
barSendNotify.setBarcode(bar_code);
|
|
|
barSendNotify.setOutboxcode(out_boxcode);
|
|
|
@@ -682,24 +700,25 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
barSendNotify.setSscode(sItem.getSend().getCode());
|
|
|
barSendNotify.setSsid(sItem.getSend().getId());
|
|
|
barSendNotify.setVendcode(enUU);
|
|
|
- barSendNotifyDao.save(barSendNotify); //保存发货单明细中的条码
|
|
|
-
|
|
|
+ barSendNotifyDao.save(barSendNotify); // 保存发货单明细中的条码
|
|
|
+
|
|
|
BarPackageDetail barPackageDetail = new BarPackageDetail();
|
|
|
barPackageDetail.setBarcode(bar_code);
|
|
|
barPackageDetail.setBarpackage(barPackageDao.findOne(pa_id));
|
|
|
barPackageDetail.setInnerqty(qty);
|
|
|
- barPackageDetailDao.save(barPackageDetail);//保存包装箱明细
|
|
|
- }
|
|
|
-
|
|
|
+ barPackageDetailDao.save(barPackageDetail);// 保存包装箱明细
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 发货单明细条码明细生成
|
|
|
+ *
|
|
|
* @param sItem
|
|
|
* @param aqtyA
|
|
|
* @param enUU
|
|
|
*/
|
|
|
- private void insertBar(SaleSendItem sItem,double qty,Long enUU,B2bCodeSet barcodeSet){
|
|
|
+ private void insertBar(SaleSendItem sItem, double qty, Long enUU, B2bCodeSet barcodeSet) {
|
|
|
BarSendNotify barSendNotify = new BarSendNotify();
|
|
|
- String bar_code = barcodeMethod(String.valueOf(sItem.getOrderItem().getProductId()),barcodeSet);
|
|
|
+ String bar_code = barcodeMethod(String.valueOf(sItem.getOrderItem().getProductId()), barcodeSet);
|
|
|
barSendNotify.setBarcode(bar_code);
|
|
|
barSendNotify.setPrintstatus("0");
|
|
|
barSendNotify.setProdcode(sItem.getOrderItem().getProduct().getCode());
|
|
|
@@ -713,39 +732,40 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
barSendNotify.setSscode(sItem.getSend().getCode());
|
|
|
barSendNotify.setSsid(sItem.getSend().getId());
|
|
|
barSendNotify.setVendcode(enUU);
|
|
|
- barSendNotifyDao.save(barSendNotify); //保存发货单明细中的条码
|
|
|
+ barSendNotifyDao.save(barSendNotify); // 保存发货单明细中的条码
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String,Object>> getPrintBarcodes(Long lpsId,List<SaleSendItem> sendItem,
|
|
|
- Long enUU) {
|
|
|
- List <Map<String, Object>> list2 = new ArrayList<Map<String,Object>>();
|
|
|
+ public List<Map<String, Object>> getPrintBarcodes(Long lpsId, List<SaleSendItem> sendItem, Long enUU) {
|
|
|
+ List<Map<String, Object>> list2 = new ArrayList<Map<String, Object>>();
|
|
|
String va = "";
|
|
|
String regex = "\\{(?:[A-Za-z][A-Za-z0-9_]*)\\}";
|
|
|
BarLabelPrintSetting setting = barLPSetingDao.findOne(lpsId);
|
|
|
- //获取打印明细的设置参数
|
|
|
- List <Map<String,Object>> parameter = commonDao.queryForList("select la_pagesize, lp_id,lp_valuetype,lp_encode,lp_name,lp_leftrate,lp_toprate,lp_width,lp_ifshownote,lp_font,lp_size,lp_notealignjustify,lp_height from bar$labelParameter left join bar$label on la_id=lp_laid where la_id="+setting.getLabel().getId());
|
|
|
- for(SaleSendItem item:sendItem){
|
|
|
- List<BarSendNotify> bars = barSendNotifyDao.findBySiid(item.getId());
|
|
|
- List <Map<String, Object>> list = new ArrayList<Map<String,Object>>();
|
|
|
- for(BarSendNotify barcode:bars){
|
|
|
- List <Map<String, Object>> list1 = new ArrayList<Map<String,Object>>();
|
|
|
- Map <String ,Object> mp1= new HashMap<String, Object>();
|
|
|
+ // 获取打印明细的设置参数
|
|
|
+ List<Map<String, Object>> parameter = commonDao
|
|
|
+ .queryForList("select la_pagesize, lp_id,lp_valuetype,lp_encode,lp_name,lp_leftrate,lp_toprate,lp_width,lp_ifshownote,lp_font,lp_size,lp_notealignjustify,lp_height from bar$labelParameter left join bar$label on la_id=lp_laid where la_id="
|
|
|
+ + setting.getLabel().getId());
|
|
|
+ for (SaleSendItem item : sendItem) {
|
|
|
+ List<BarSendNotify> bars = barSendNotifyDao.findBySiid(item.getId());
|
|
|
+ List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
|
|
+ for (BarSendNotify barcode : bars) {
|
|
|
+ List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>();
|
|
|
+ Map<String, Object> mp1 = new HashMap<String, Object>();
|
|
|
va = setting.getSql().replaceAll(regex, String.valueOf(barcode.getId()));
|
|
|
- List <Map<String,Object>> listData = commonDao.queryForList(va);
|
|
|
- for(Map<String,Object> mapD:listData){
|
|
|
- for(Map<String,Object> param: parameter){
|
|
|
+ List<Map<String, Object>> listData = commonDao.queryForList(va);
|
|
|
+ for (Map<String, Object> mapD : listData) {
|
|
|
+ for (Map<String, Object> param : parameter) {
|
|
|
mp1 = param;
|
|
|
mp1.put("value", mapD.get(param.get("lp_name")));
|
|
|
- list1.add(mp1);
|
|
|
+ list1.add(mp1);
|
|
|
}
|
|
|
}
|
|
|
- Map<String, Object> mp = new HashMap<String, Object>();
|
|
|
+ Map<String, Object> mp = new HashMap<String, Object>();
|
|
|
mp.put("store", list1);
|
|
|
list.add(mp);
|
|
|
}
|
|
|
- Map<String, Object> mp = new HashMap<String, Object>();
|
|
|
- mp.put("si_id",item.getId());
|
|
|
+ Map<String, Object> mp = new HashMap<String, Object>();
|
|
|
+ mp.put("si_id", item.getId());
|
|
|
mp.put("pagesize", parameter.get(0).get("la_pagesize"));
|
|
|
mp.put("data", list);
|
|
|
list2.add(mp);
|
|
|
@@ -757,36 +777,38 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
public List<BarLabelPrintSetting> getPrintTemplate(Long id, String type) {
|
|
|
SaleSend saleSend = saleSendDao.findOne(id);
|
|
|
Long custUU = saleSend.getCustUU();
|
|
|
- String caller ;
|
|
|
- if(type.equals("Bar")){
|
|
|
+ String caller;
|
|
|
+ if (type.equals("Bar")) {
|
|
|
caller = "B2B!BarPrint";
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
caller = "B2B!OutBoxPrint";
|
|
|
}
|
|
|
- List<BarLabelPrintSetting> setting = barLPSetingDao.findByEnUUAndCaller(custUU,caller);
|
|
|
- if(setting.size() >0){
|
|
|
+ List<BarLabelPrintSetting> setting = barLPSetingDao.findByEnUUAndCaller(custUU, caller);
|
|
|
+ if (setting.size() > 0) {
|
|
|
return setting;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
throw new IllegalOperatorException("未维护相关的打印模板!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> getSPrintBarcode(Long lpsId, Long bsnId) {
|
|
|
- List <Map<String, Object>> list = new ArrayList<Map<String,Object>>();
|
|
|
+ List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
|
|
String va = "";
|
|
|
String regex = "\\{(?:[A-Za-z][A-Za-z0-9_]*)\\}";
|
|
|
BarLabelPrintSetting setting = barLPSetingDao.findOne(lpsId);
|
|
|
- //获取打印明细的设置参数
|
|
|
- List <Map<String,Object>> parameter = commonDao.queryForList("select la_pagesize, lp_id,lp_valuetype,lp_encode,lp_name,lp_leftrate,lp_toprate,lp_width,lp_ifshownote,lp_font,lp_size,lp_notealignjustify,lp_height from bar$labelParameter left join bar$label on la_id=lp_laid where la_id="+setting.getLabel().getId());
|
|
|
- Map <String ,Object> map= new HashMap<String, Object>();
|
|
|
+ // 获取打印明细的设置参数
|
|
|
+ List<Map<String, Object>> parameter = commonDao
|
|
|
+ .queryForList("select la_pagesize, lp_id,lp_valuetype,lp_encode,lp_name,lp_leftrate,lp_toprate,lp_width,lp_ifshownote,lp_font,lp_size,lp_notealignjustify,lp_height from bar$labelParameter left join bar$label on la_id=lp_laid where la_id="
|
|
|
+ + setting.getLabel().getId());
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
va = setting.getSql().replaceAll(regex, String.valueOf(bsnId));
|
|
|
- List <Map<String,Object>> listData = commonDao.queryForList(va);
|
|
|
- for(Map<String,Object> mapD:listData){
|
|
|
- for(Map<String,Object> param: parameter){
|
|
|
+ List<Map<String, Object>> listData = commonDao.queryForList(va);
|
|
|
+ for (Map<String, Object> mapD : listData) {
|
|
|
+ for (Map<String, Object> param : parameter) {
|
|
|
map = param;
|
|
|
map.put("value", mapD.get(param.get("lp_name")));
|
|
|
- list.add(map);
|
|
|
+ list.add(map);
|
|
|
}
|
|
|
}
|
|
|
return list;
|
|
|
@@ -795,10 +817,10 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
@Override
|
|
|
public void updatePrintStatus(List<SaleSendItem> saleSendItems) {
|
|
|
List<SaleSendItem> items = new ArrayList<SaleSendItem>();
|
|
|
- if(!CollectionUtils.isEmpty(saleSendItems)) {
|
|
|
- for(SaleSendItem item : saleSendItems) {
|
|
|
+ if (!CollectionUtils.isEmpty(saleSendItems)) {
|
|
|
+ for (SaleSendItem item : saleSendItems) {
|
|
|
item = saleSendItemDao.findOne(item.getId());
|
|
|
- if(item != null) {
|
|
|
+ if (item != null) {
|
|
|
item.setBarPrintStatus((long) 1);
|
|
|
items.add(item);
|
|
|
}
|
|
|
@@ -814,6 +836,7 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
|
|
|
|
|
|
@Override
|
|
|
public Long getSaleSendVerify() {
|
|
|
- return saleSendAllDao.findByVendUUAndVerifystatus(SystemSession.getUser().getEnterprise().getUu(), Constant.YES);
|
|
|
+ return saleSendAllDao
|
|
|
+ .findByVendUUAndVerifystatus(SystemSession.getUser().getEnterprise().getUu(), Constant.YES);
|
|
|
}
|
|
|
}
|