hsh 5 mesi fa
parent
commit
17f7e1f190

+ 6 - 6
src/main/java/cn/hnthyy/thmz/service/impl/his/yp/YpZdDictServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.service.impl.his.yp;
 
 import cn.hnthyy.thmz.Utils.ColumnSqlUtil;
+import cn.hnthyy.thmz.Utils.DecimalUtil;
 import cn.hnthyy.thmz.Utils.PyWbUtil;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.mz.Employee;
@@ -172,12 +173,11 @@ public class YpZdDictServiceImpl implements YpZdDictService {
             String changedFieldsOfSql = ColumnSqlUtil.getChangedNotFieldsOfSql(new YpZdDict(), ypZdDict,1);
             ypZdDictMapper.insertYpZdDictSql(changedFieldsOfSql);
             if(ypZdDict.getSerial().equals("99")){
-                YpZdDict minYp = ypZdDict;
-                minYp.setSerial("01");
-                minYp.setPackRetprice(ypZdDict.getPackRetprice().divide(ypZdDict.getPackSize()));
-                minYp.setBuyPrice(ypZdDict.getBuyPrice().divide(ypZdDict.getPackSize()));
-                minYp.setYbxjPrice(ypZdDict.getYbxjPrice().divide(ypZdDict.getPackSize()));
-                changedFieldsOfSql = ColumnSqlUtil.getChangedNotFieldsOfSql(new YpZdDict(), minYp,1);
+                ypZdDict.setSerial("01");
+                ypZdDict.setPackRetprice(DecimalUtil.divide(ypZdDict.getPackRetprice(), ypZdDict.getPackSize(), 2));
+                ypZdDict.setBuyPrice(DecimalUtil.divide(ypZdDict.getBuyPrice(),ypZdDict.getPackSize(), 2));
+                ypZdDict.setYbxjPrice(DecimalUtil.divide(ypZdDict.getYbxjPrice(), ypZdDict.getPackSize(), 2));
+                changedFieldsOfSql = ColumnSqlUtil.getChangedNotFieldsOfSql(new YpZdDict(), ypZdDict,1);
                 ypZdDictMapper.insertYpZdDictSql(changedFieldsOfSql);
             }
             ypPrintNameMapper.insertYpPrintName(new YpPrintName(ypZdDict.getCode(),ypZdDict.getName(),ypZdDict.getPyCode(),ypZdDict.getWbCode(),"T"));