Commit 79527944 by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents e1673518 51e5fcfd
...@@ -71,6 +71,8 @@ public class HGSC005 extends DaoEPBase { ...@@ -71,6 +71,8 @@ public class HGSC005 extends DaoEPBase {
public static final String UPDATE = "HGSC005.update"; public static final String UPDATE = "HGSC005.update";
public static final String DELETE = "HGSC005.delete"; public static final String DELETE = "HGSC005.delete";
public static final String BATCH_COMMIT = "HGSC005.batch_commit"; public static final String BATCH_COMMIT = "HGSC005.batch_commit";
public static final String DELETE_BY_MAT_ID = "HGSC005.delete_by_mat_id";
private Long id = new Long(0); private Long id = new Long(0);
private Long matId = new Long(0); /* 物料清单ID*/ private Long matId = new Long(0); /* 物料清单ID*/
......
...@@ -102,6 +102,7 @@ public class HGSC005A extends DaoEPBase { ...@@ -102,6 +102,7 @@ public class HGSC005A extends DaoEPBase {
public static final String INSERT = "HGSC005A.insert"; public static final String INSERT = "HGSC005A.insert";
public static final String UPDATE = "HGSC005A.update"; public static final String UPDATE = "HGSC005A.update";
public static final String DELETE = "HGSC005A.delete"; public static final String DELETE = "HGSC005A.delete";
public static final String BATCH_DELETE = "HGSC005.batch_delete";
public static final String UPDATE_PLAN_DATE = "HGSC005A.update_plan_date"; public static final String UPDATE_PLAN_DATE = "HGSC005A.update_plan_date";
private Long id = new Long(0); private Long id = new Long(0);
......
...@@ -213,6 +213,11 @@ ...@@ -213,6 +213,11 @@
id = #id# id = #id#
</delete> </delete>
<delete id="delete_by_mat_id">
DELETE FROM ${hggpSchema}.HGSC005 WHERE
mat_id = #matId#
</delete>
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGSC005 UPDATE ${hggpSchema}.HGSC005
SET SET
......
...@@ -199,7 +199,7 @@ ...@@ -199,7 +199,7 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
id asc product_type asc ,process_order desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
...@@ -367,6 +367,11 @@ ...@@ -367,6 +367,11 @@
id = #id# id = #id#
</delete> </delete>
<delete id="batch_delete">
DELETE FROM ${hggpSchema}.HGSC005A WHERE
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</delete>
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGSC005A UPDATE ${hggpSchema}.HGSC005A
SET SET
......
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
id asc product_type asc ,process_order desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
id asc id desc, product_type asc ,process_order desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
......
...@@ -294,6 +294,14 @@ public class HGSCTools { ...@@ -294,6 +294,14 @@ public class HGSCTools {
return CollectionUtils.isEmpty(results) ? null : results; return CollectionUtils.isEmpty(results) ? null : results;
} }
public static List<HGSC005A> queryByMatId(Long matId){
AssertUtils.isTrue(Objects.isNull(matId)||matId<=0, "物料清单ID不能为空!");
Map paramMap = new HashMap();
paramMap.put(HGSC005A.FIELD_mat_id, matId);
List<HGSC005A> results = DaoBase.getInstance().query(HGSC005A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
private static List<HGSC005A> generatorNewPlanDetail(HGSC005A hgsc005a){ private static List<HGSC005A> generatorNewPlanDetail(HGSC005A hgsc005a){
//通过存货档案编码查询存货档案工序 //通过存货档案编码查询存货档案工序
...@@ -392,16 +400,29 @@ public class HGSCTools { ...@@ -392,16 +400,29 @@ public class HGSCTools {
public static void delete(HGSC005A hgsc005a){ public static void delete(HGSC005A hgsc005a){
checkUpdateData(hgsc005a); checkUpdateData(hgsc005a);
Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a); Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a);
List<Long> deleteIds = new ArrayList<>();
List<HGSC005A> updateList = new ArrayList<>();
oldObjMap.forEach((k,v)->{ oldObjMap.forEach((k,v)->{
HGSC005A oldObj = v.get(); HGSC005A oldObj = v.get();
if(oldObj.getQuantity()-hgsc005a.getQuantity()<=0){ if(oldObj.getQuantity()-hgsc005a.getQuantity()<=0){
DaoUtils.update(HGSC005A.DELETE, new HashMap<String,Object>(){{put(HGSC005A.FIELD_id,oldObj.getId());}}); deleteIds.add(oldObj.getId());
}else{ }else{
oldObj.setQuantity(oldObj.getQuantity()-hgsc005a.getQuantity()); oldObj.setQuantity(oldObj.getQuantity()-hgsc005a.getQuantity());
oldObj.setUnfinishQuantity(oldObj.getQuantity()-oldObj.getFinishQuantity()); oldObj.setUnfinishQuantity(oldObj.getQuantity()-oldObj.getFinishQuantity());
DaoUtils.update(HGSC005A.UPDATE,oldObj); updateList.add(oldObj);
} }
}); });
if(CollectionUtils.isNotEmpty(deleteIds)){
List<HGSC005A> dbList = queryByMatId(hgsc005a.getMatId());
//如果全部删除则删除主表
if(deleteIds.size() == dbList.size()){
DaoUtils.update(HGSC005.DELETE_BY_MAT_ID,new HashMap<String,Object>(){{put(HGSC005.FIELD_mat_id,hgsc005a.getMatId());}});
}
DaoUtils.update(HGSC005A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",deleteIds);}});
}
if(CollectionUtils.isNotEmpty(updateList)){
DaoUtils.updateBatch(HGSC005A.UPDATE,updateList);
}
} }
/** /**
......
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/>
<EF:EFColumn ename="planEndDate" cname="计划完工日期" width="120" enable="true" align="center" editType="date" <EF:EFColumn ename="planEndDate" cname="计划完工日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/>
<EF:EFColumn ename="singleWeight" cname="单重" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="totalWeight" cname="计划重量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="finishWeight" cname="完成重量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="unfinishWeight" cname="未完成重量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="quantity" cname="计划数量" width="120" enable="true" align="center" readOnly="true"/> <EF:EFColumn ename="quantity" cname="计划数量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="finishQuantity" cname="完成数量" width="120" enable="true" align="center" readOnly="true"/> <EF:EFColumn ename="finishQuantity" cname="完成数量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="unfinishQuantity" cname="未完成数量" width="120" enable="true" align="center" readOnly="true"/> <EF:EFColumn ename="unfinishQuantity" cname="未完成数量" width="120" enable="true" align="center" readOnly="true"/>
......
...@@ -36,9 +36,11 @@ ...@@ -36,9 +36,11 @@
<EF:EFColumn ename="processName" cname="工序" width="120" enable="true" align="center" readOnly="true"/> <EF:EFColumn ename="processName" cname="工序" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="planEndDate" cname="计划完工日期" width="120" enable="true" align="center" editType="date" <EF:EFColumn ename="planEndDate" cname="计划完工日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" /> dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" />
<EF:EFColumn ename="singleWeight" cname="单重" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="totalWeight" cname="订单重量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="assignWeight" cname="派工重量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="unassignWeight" cname="待派工重量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="quantity" cname="订单数量" width="120" enable="true" align="center" readOnly="true"/> <EF:EFColumn ename="quantity" cname="订单数量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="assignDate" cname="派工日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" />
<EF:EFColumn ename="assignQuantity" cname="派工数量" width="120" enable="true" align="center" readOnly="true"/> <EF:EFColumn ename="assignQuantity" cname="派工数量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFColumn ename="unassignQuantity" cname="待派工数量" width="120" enable="true" align="center" readOnly="true"/> <EF:EFColumn ename="unassignQuantity" cname="待派工数量" width="120" enable="true" align="center" readOnly="true"/>
<EF:EFComboColumn ename="assignStatus" cname="派工状态" width="80" align="center" <EF:EFComboColumn ename="assignStatus" cname="派工状态" width="80" align="center"
......
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