zthwr 9 месяцев назад
Родитель
Сommit
2c0b54079a
1 измененных файлов с 83 добавлено и 34 удалено
  1. 83 34
      mmpac/ic/srt/client/nc/ui/ic/pub/bill/GeneralButtonManager.java

+ 83 - 34
mmpac/ic/srt/client/nc/ui/ic/pub/bill/GeneralButtonManager.java

@@ -865,23 +865,34 @@ public class GeneralButtonManager implements IButtonManager,BillActionListener {
 				if("46".equals(cbilltypecode)) {
 					//实入数量
 					UFDouble ninnum = generalBillItemVO[j].getNinnum();
+					
+					//实入辅数量
+					Object ninassistnumobj= generalBillItemVO[j].getNinassistnum();
+					
 					String sql = "select execnum from mmpac_order_in where 	pk_order_in = '"+cfirstbillbid+"'";
 					Object execnum = (Object) iuap.executeQuery(sql, new ColumnProcessor());
 					
+					String sql2 = "select execnastnum from mmpac_order_in where pk_order_in = '"+cfirstbillbid+"'";
+					Object execnastnum =(Object) iuap.executeQuery(sql, new ColumnProcessor());
+					
 					if(null==execnum) {
 						continue;
 					}
 					
-					
 					UFDouble result  = new UFDouble(execnum.toString()).sub(ninnum);
 					
+					UFDouble fzresult= UFDouble.ZERO_DBL;//已执行辅数量
+					if(null!=execnastnum) {
+						 fzresult= new UFDouble(execnastnum.toString()).sub(new UFDouble(ninassistnumobj.toString()));//已执行辅数量
+					}
+					
 					StringBuffer update = new StringBuffer();
 					update.append(" update mmpac_order_in set");
 					//如果生产总订单成品明细已执行数量已经为0,已执行数量直接给null.而不是0.00 避免显示误解
 					if(result.doubleValue() == 0) {
-						update.append(" execnum = null");
+						update.append(" execnum = null  , execnastnum=null  ");
 					}else {
-						update.append(" execnum = '"+result+"'");
+						update.append(" execnum = '"+result+"', execnastnum='"+fzresult+"'   ");
 					}
 					update.append(" where pk_order_in = '"+cfirstbillbid+"'");
 					iorder.updateExecnum(update.toString());
@@ -890,70 +901,97 @@ public class GeneralButtonManager implements IButtonManager,BillActionListener {
 				if("4D".equals(cbilltypecode)) {
 					//实出数量
 					UFDouble noutnum = generalBillItemVO[j].getNoutnum();
+					
+					//实出辅数量
+					Object noutassistnumobj = generalBillItemVO[j].getNoutassistnum();
+					
 					String sql = "select execnum from mmpac_order_issue where pk_order_issue = '"+cfirstbillbid+"'";
 					Object execnum = (Object) iuap.executeQuery(sql, new ColumnProcessor());
 					
+					
+					String sql2 = "select execnastnum from mmpac_order_issue where pk_order_issue = '"+cfirstbillbid+"'";
+					Object execnastnum = (Object) iuap.executeQuery(sql, new ColumnProcessor());
+					
+					
 					if(null==execnum) {
 						continue;
 					}
 					
 					UFDouble result  = new UFDouble(execnum.toString()).sub(noutnum);
-					StringBuffer update = new StringBuffer();
-					update.append(" update mmpac_order_issue set");
-					//如果生产总订单材料明细已执行数量已经为0,已执行数量直接给null.而不是0.00 避免显示误解
-					if(result.doubleValue() == 0) {
-						update.append(" execnum = null");
-					}else {
-						update.append(" execnum = '"+result+"'");
-					}
-					update.append(" where pk_order_issue = '"+cfirstbillbid+"'");
-					iorder.updateExecnum(update.toString());
-				}
-				//销售出库回写生产总订单材料明细
-				if("4C".equals(cbilltypecode)) {
-					//实出数量
-					UFDouble noutnum = generalBillItemVO[j].getNoutnum();
-					String sql = "select bdef8 from mmpac_order_in where 	pk_order_in = '"+cfirstbillbid+"'";
-					Object bdef8 = (Object) iuap.executeQuery(sql, new ColumnProcessor());
-					
 					
-					if(null==bdef8) {
-						continue;
+					UFDouble fzresult= UFDouble.ZERO_DBL;//已执行辅数量
+					if(null!=execnastnum) {
+						 fzresult= new UFDouble(execnastnum.toString()).sub(new UFDouble(noutassistnumobj.toString()));//已执行辅数量
 					}
 					
-					UFDouble result  = new UFDouble(bdef8.toString()).sub(noutnum);
 					
 					StringBuffer update = new StringBuffer();
-					update.append(" update mmpac_order_in set");
-					//如果生产总订单成品明细已执行数量已经为0,已执行数量直接给null.而不是0.00 避免显示误解
+					update.append(" update mmpac_order_issue set");
+					//如果生产总订单材料明细已执行数量已经为0,已执行数量直接给null.而不是0.00 避免显示误解
 					if(result.doubleValue() == 0) {
-						update.append(" bdef8 = null");
+						update.append(" execnum = null, execnastnum=null ");
 					}else {
-						update.append(" bdef8 = '"+result+"'");
+						update.append(" execnum = '"+result+"', execnastnum='"+fzresult+"'   ");
 					}
-					update.append(" where pk_order_in = '"+cfirstbillbid+"'");
+					update.append(" where pk_order_issue = '"+cfirstbillbid+"'");
 					iorder.updateExecnum(update.toString());
 				}
+				//销售出库回写生产总订单材料明细---销售订单删除再回写
+//				if("4C".equals(cbilltypecode)) {
+//					//实出数量
+//					UFDouble noutnum = generalBillItemVO[j].getNoutnum();
+//					String sql = "select bdef8 from mmpac_order_in where 	pk_order_in = '"+cfirstbillbid+"'";
+//					Object bdef8 = (Object) iuap.executeQuery(sql, new ColumnProcessor());
+//					
+//					
+//					if(null==bdef8) {
+//						continue;
+//					}
+//					
+//					UFDouble result  = new UFDouble(bdef8.toString()).sub(noutnum);
+//					
+//					StringBuffer update = new StringBuffer();
+//					update.append(" update mmpac_order_in set");
+//					//如果生产总订单成品明细已执行数量已经为0,已执行数量直接给null.而不是0.00 避免显示误解
+//					if(result.doubleValue() == 0) {
+//						update.append(" bdef8 = null");
+//					}else {
+//						update.append(" bdef8 = '"+result+"'");
+//					}
+//					update.append(" where pk_order_in = '"+cfirstbillbid+"'");
+//					iorder.updateExecnum(update.toString());
+//				}
 				//其他出库回写生产总订单委外其他出库
 				if("4I".equals(cbilltypecode)) {
 					//实出数量
 					UFDouble noutnum = generalBillItemVO[j].getNoutnum();
+					//实出辅数量
+					Object noutassistnumobj = generalBillItemVO[j].getNoutassistnum();
+					
 					String sql = "select execnum from mmpac_order_otherout where pk_order_otherout = '"+cfirstbillbid+"'";
 					Object execnum = (Object) iuap.executeQuery(sql, new ColumnProcessor());
 					
+					String sql2 = "select execnastnum from mmpac_order_otherout where pk_order_otherout = '"+cfirstbillbid+"'";
+					Object execnastnum = (Object) iuap.executeQuery(sql, new ColumnProcessor());
 					
 					if(null==execnum) {
 						continue;
 					}
 					
-					UFDouble result  = new UFDouble(execnum.toString()).sub(noutnum);
+					UFDouble result  = new UFDouble(execnum.toString()).sub(noutnum);//已执行主数量
+					
+					UFDouble fzresult= UFDouble.ZERO_DBL;//已执行辅数量
+					if(null!=execnastnum) {
+						 fzresult= new UFDouble(execnastnum.toString()).sub(new UFDouble(noutassistnumobj.toString()));//已执行辅数量
+					}
+					
 					StringBuffer update = new StringBuffer();
 					update.append(" update mmpac_order_otherout set");
 					//如果生产总订单委外其他出库已执行数量已经为0,已执行数量直接给null.而不是0.00 避免显示误解
 					if(result.doubleValue() == 0) {
-						update.append(" execnum = null");
+						update.append(" execnum = null , execnastnum=null ");
 					}else {
-						update.append(" execnum = '"+result+"'");
+						update.append(" execnum = '"+result+"' , execnastnum='"+fzresult+"'  ");
 					}
 					update.append(" where pk_order_otherout = '"+cfirstbillbid+"'");
 					iorder.updateExecnum(update.toString());
@@ -963,9 +1001,15 @@ public class GeneralButtonManager implements IButtonManager,BillActionListener {
 				if("4A".equals(cbilltypecode)) {
 					//实入数量
 					UFDouble ninnum = generalBillItemVO[j].getNinnum();
+					//实入辅数量
+					Object ninassistnumobj= generalBillItemVO[j].getNinassistnum();
+
 					String sql = "select execnum from mmpac_order_otherin where pk_order_otherin = '"+cfirstbillbid+"'";
 					Object execnum = (Object) iuap.executeQuery(sql, new ColumnProcessor());
 					
+					String sql2 = "select execnastnum from mmpac_order_otherout where pk_order_otherout = '"+cfirstbillbid+"'";
+					Object execnastnum = (Object) iuap.executeQuery(sql, new ColumnProcessor());
+					
 					
 					if(null==execnum) {
 						continue;
@@ -974,13 +1018,18 @@ public class GeneralButtonManager implements IButtonManager,BillActionListener {
 					
 					UFDouble result  = new UFDouble(execnum.toString()).sub(ninnum);
 					
+					UFDouble fzresult= UFDouble.ZERO_DBL;//已执行辅数量
+					if(null!=execnastnum) {
+						 fzresult= new UFDouble(execnastnum.toString()).sub(new UFDouble(ninassistnumobj.toString()));//已执行辅数量
+					}
+					
 					StringBuffer update = new StringBuffer();
 					update.append(" update mmpac_order_otherin set");
 					//如果生产总订单委外其他入库已执行数量已经为0,已执行数量直接给null.而不是0.00 避免显示误解
 					if(result.doubleValue() == 0) {
-						update.append(" execnum = null");
+						update.append(" execnum = null , execnastnum=null ");
 					}else {
-						update.append(" execnum = '"+result+"'");
+						update.append(" execnum = '"+result+"' , execnastnum='"+fzresult+"'   ");
 					}
 					update.append(" where pk_order_otherin = '"+cfirstbillbid+"'");
 					iorder.updateExecnum(update.toString());