Commit 817f4be7 by 宋祥

1.修复生产领料提交BUG

parent 4ef69092
...@@ -176,47 +176,37 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -176,47 +176,37 @@ public class ServiceHGKC008 extends ServiceBase {
AssertUtils.isEmpty(hgkc008.getWhCode(), "请选择仓库信息!"); AssertUtils.isEmpty(hgkc008.getWhCode(), "请选择仓库信息!");
AssertUtils.isEmpty(hgkc008.getWhName(), "请选择仓库信息!"); AssertUtils.isEmpty(hgkc008.getWhName(), "请选择仓库信息!");
} }
/** /**
* 修改启用状态 * 修改启用状态
* @param inInfo *
* @return * @param inInfo
*/ * @return
*/
public EiInfo updateStatus(EiInfo inInfo){ public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try { try {
HGKC008 hgkc008 = new HGKC008(); HGKC008 fKc008 = MapUtils.toDaoEPBase(inInfo, HGKC008.class);
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); //查看是否能获取到账期,获取不到就提示
for (i = 0; i < eiBlock.getRowCount(); i++) { HGKC008 getKc008 = HGKCTools.HgKc008.getById(fKc008.getId());
Map<?, ?> map = eiBlock.getRow(i); HGCWTools.HgCw001.getAccountPeriod(getKc008.getCompanyCode(), getKc008.getReceiptDate());
hgkc008.fromMap(map); HGKCTools.HgKc008A.updateStatus(fKc008.getApplyCode(), HgKcConst.HgKc008.Status.S1);
//查看是否能获取到账期,获取不到就提示 List<HGKC008A> dbKc008As = HGKCTools.HgKc008A.getHgkc008aList(fKc008.getId());
HGKC008 getKc008 = HGKCTools.HgKc008.getById(hgkc008.getId()); if (!CollectionUtils.isEmpty(dbKc008As)) {
HGCWTools.HgCw001.getAccountPeriod(getKc008.getCompanyCode(),getKc008.getReceiptDate()); for (HGKC008A dbKc008A : dbKc008As) {
DaoUtils.update(HGKC008.UPDATE_STATUS, hgkc008.toMap()); // 更新明细状态
} HGKCTools.HgKc008A.updateStatus(dbKc008A.getApplyLineCode(), HgKcConst.HgKc008.Status.S1);
List<HGKC008A> hgkc008AList = HGKCTools.HgKc008A.getHgkc008aList(hgkc008.getId()); // 领料如果是正数则为出库,需要减少库存,如果是退回则要加库存
if(!CollectionUtils.isEmpty(hgkc008AList)){ BigDecimal qty = dbKc008A.getInvQty().multiply(new BigDecimal(-1));
for (HGKC008A hgkc008A : hgkc008AList) { BigDecimal invUnitWeight = dbKc008A.getInvUnitWeight().multiply(new BigDecimal(-1));
// 更新明细状态 BigDecimal invWeight = dbKc008A.getInvWeight().multiply(new BigDecimal(-1));
HGKCTools.HgKc008A.updateStatus(hgkc008A.getApplyLineCode(), HgKcConst.HgKc008.Status.S1); // 增加库存
//领料如果是正数则为出库,需要减少库存,如果是退回则要加库存 HGKCUtils.HgKc010.updateInv(dbKc008A.getCompanyCode(), dbKc008A.getWhCode(),
BigDecimal qty = hgkc008A.getInvQty().multiply(new BigDecimal(-1)); dbKc008A.getInventCode(), qty, invUnitWeight, invWeight);
BigDecimal invUnitWeight = hgkc008A.getInvUnitWeight().multiply(new BigDecimal(-1)); }
BigDecimal invWeight = hgkc008A.getInvWeight().multiply(new BigDecimal(-1)); }
//增加库存 inInfo.setMsg("提交成功!");
HGKCUtils.HgKc010.updateInv(hgkc008A.getCompanyCode(), hgkc008A.getWhCode(), } catch (Exception e) {
hgkc008A.getInventCode(), qty, invUnitWeight, invWeight); LogUtils.setMsg(inInfo, e, "提交失败");
}
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
} }
return inInfo; return inInfo;
} }
......
...@@ -462,7 +462,8 @@ public class HGKCUtils { ...@@ -462,7 +462,8 @@ public class HGKCUtils {
*/ */
private static void updateInvData(HGKC010 newKc010, HGKC010 dbKc010) { private static void updateInvData(HGKC010 newKc010, HGKC010 dbKc010) {
BigDecimal newQty = newKc010.getInvQty().add(dbKc010.getInvQty()); BigDecimal newQty = newKc010.getInvQty().add(dbKc010.getInvQty());
AssertUtils.isGt(BigDecimal.ZERO, newQty, String.format("更新后的库存数量小于0(%s),请检查", newQty)); AssertUtils.isGt(BigDecimal.ZERO, newQty, String.format("更新后的库存数量小于0(%s),请检查",
newQty.stripTrailingZeros().toPlainString()));
BigDecimal newWeight = newQty.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO BigDecimal newWeight = newQty.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO
: newKc010.getInvWeight().add(dbKc010.getInvWeight()); : newKc010.getInvWeight().add(dbKc010.getInvWeight());
BigDecimal newUnitWeight = newQty.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO BigDecimal newUnitWeight = newQty.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment