Browse Source

销售订单删除后需回写辅数量

yaoyu 1 year ago
parent
commit
0aae59beb6
1 changed files with 11 additions and 3 deletions
  1. 11 3
      mmpac/so/src/private/nc/bs/pub/action/N_30_SoBlankout.java

+ 11 - 3
mmpac/so/src/private/nc/bs/pub/action/N_30_SoBlankout.java

@@ -189,9 +189,12 @@ public class N_30_SoBlankout extends AbstractCompiler2 {
 							String cfirstbillbid = saleorderBVOs[i].getCsourcebillbodyid();
 							//实出数量
 							UFDouble noutnum = saleorderBVOs[i].getNnumber();
+							//实出辅
+							UFDouble npacknumber =  saleorderBVOs[i].getNpacknumber();
 							String sql = "select bdef8 from mmpac_order_in where 	pk_order_in = '"+cfirstbillbid+"'";
 							Object bdef8 = (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==bdef8) {
 								continue;
@@ -199,13 +202,18 @@ public class N_30_SoBlankout extends AbstractCompiler2 {
 							
 							UFDouble result  = new UFDouble(bdef8.toString()).sub(noutnum);
 							
+							UFDouble fzresult = UFDouble.ZERO_DBL;//已执行辅数量
+							if(null != execnastnum) {
+								 fzresult= new UFDouble(execnastnum.toString()).sub(new UFDouble(npacknumber.toString()));//已执行辅数量
+							}
+							
 							StringBuffer update = new StringBuffer();
 							update.append(" update mmpac_order_in set");
 							//如果生产总订单成品明细已执行数量已经为0,已执行数量直接给null.而不是0.00 避免显示误解
 							if(result.doubleValue() == 0) {
-								update.append(" bdef8 = null");
+								update.append(" bdef8 = null, bdef9 = null");
 							}else {
-								update.append(" bdef8 = '"+result+"'");
+								update.append(" bdef8 = '"+result+"' ,bdef9 = '"+fzresult+"'");
 							}
 							update.append(" where pk_order_in = '"+cfirstbillbid+"'");
 							iorder.updateExecnum(update.toString());