|
|
@@ -532,7 +532,30 @@ public class MESServiceImpl implements MESService {
|
|
|
"values (PRODIODETAIL_SEQ.nextval," + bcpiid + ",'" + bccode + "','"+bcpiclass+"'," + detno + ",'" + itemNo +
|
|
|
"'," + qty + ",'" + warehouses2[0] + "','" + warehouses2[1] + "','" + warehouses[0] + "','" + warehouses[1] + "','"+ficmoBillNo+"',"+mmdetno+")");
|
|
|
}
|
|
|
- SqlRowList sqlRowList = baseDao.queryForRowSet("select round((mm_qty-nvl(mm_canuserepqty,0)-(nvl(mm_havegetqty,0)-nvl(mm_haverepqty,0)+(nvl(mm_returnmqty,0)-nvl(mm_repreturnmqty,0))-(nvl(mm_addqty,0)-NVL(mm_repaddqty,0)))-nvl(mm_totaluseqty,0)+NVL(mm_repqty,0))-NVL(mm_stepinqty,0),7) mmqty from MakeMaterial where mm_id in (" + lineId + ")");
|
|
|
+ int count1 = baseDao.getCount("select count(1) from MakeMaterial where mm_prodcode='" + itemNo + "' and mm_id in (" + lineId + ")");
|
|
|
+ if (count1>0) {
|
|
|
+ SqlRowList sqlRowList = baseDao.queryForRowSet("select round((mm_qty-nvl(mm_canuserepqty,0)-(nvl" +
|
|
|
+ "(mm_havegetqty,0)-nvl(mm_haverepqty,0)+(nvl(mm_returnmqty,0)-nvl(mm_repreturnmqty,0))-(nvl" +
|
|
|
+ "(mm_addqty,0)-NVL(mm_repaddqty,0)))-nvl(mm_totaluseqty,0)+NVL(mm_repqty,0))-NVL(mm_stepinqty,0)" +
|
|
|
+ ",7) mmqty from MakeMaterial where mm_prodcode='" + itemNo + "' and mm_id in (" + lineId + ")");
|
|
|
+ if (sqlRowList.next()) {
|
|
|
+ Double mmqty = sqlRowList.getGeneralDouble("mmqty");
|
|
|
+ qty = qty.compareTo(mmqty) > 0 ? mmqty : qty;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ int count3 = baseDao.getCount("select count(1) from MakeMaterialreplace where mp_prodcode='" + itemNo + "' and mp_mmid in (" + lineId + ")");
|
|
|
+ if (count3>0){
|
|
|
+ SqlRowList sqlRowList1 = baseDao.queryForRowSet("select nvl(mp_canuseqty,0)-(nvl(mp_haverepqty,0)-NVL(mp_addqty,0)+NVL(mp_returnmqty,0))-nvl(mp_repqty,0) mpqty from MakeMaterialreplace where mp_prodcode='" + itemNo + "' and mp_mmid in (" + lineId + ")");
|
|
|
+ if (sqlRowList1.next()){
|
|
|
+ Double mpqty = sqlRowList1.getGeneralDouble("mpqty");
|
|
|
+ qty = qty.compareTo(mpqty) > 0 ? mpqty : qty;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SqlRowList sqlRowList = baseDao.queryForRowSet("select round((mm_qty-nvl(mm_canuserepqty,0)-(nvl" +
|
|
|
+ "(mm_havegetqty,0)-nvl(mm_haverepqty,0)+(nvl(mm_returnmqty,0)-nvl(mm_repreturnmqty,0))-(nvl" +
|
|
|
+ "(mm_addqty,0)-NVL(mm_repaddqty,0)))-nvl(mm_totaluseqty,0)+NVL(mm_repqty,0))-NVL(mm_stepinqty,0)" +
|
|
|
+ ",7) mmqty from MakeMaterial where mm_prodcode='"+itemNo+"' mm_id in (" + lineId + ")");
|
|
|
if (sqlRowList.next()){
|
|
|
Double mmqty = sqlRowList.getGeneralDouble("mmqty");
|
|
|
qty = qty.compareTo(mmqty) > 0 ? mmqty : qty;
|