ruanqi 1 year ago
parent
commit
44c8747b9b
  1. 2
      src/main/java/com/xujie/sys/modules/production/controller/OperatorGroupController.java
  2. 10
      src/main/java/com/xujie/sys/modules/production/data/Operator.java
  3. 4
      src/main/java/com/xujie/sys/modules/production/service/impl/OperatorGroupServiceImpl.java
  4. 21
      src/main/resources/mapper/production/OperatorGroupMapper.xml

2
src/main/java/com/xujie/sys/modules/production/controller/OperatorGroupController.java

@ -41,6 +41,8 @@ public class OperatorGroupController {
@PostMapping(value="/saveOperatorGroupDetail") @PostMapping(value="/saveOperatorGroupDetail")
@ResponseBody @ResponseBody
public R saveOperatorGroupDetail(@RequestBody OperatorGroupPlanHeaderData data){ public R saveOperatorGroupDetail(@RequestBody OperatorGroupPlanHeaderData data){
operatorGroupService.saveOperatorGroupDetail(data);
return R.ok(); return R.ok();
} }

10
src/main/java/com/xujie/sys/modules/production/data/Operator.java

@ -12,7 +12,7 @@ public class Operator {
* *
*/ */
private String operatorID; private String operatorID;
private String operatorGroupId;
/** /**
* *
*/ */
@ -119,5 +119,13 @@ public class Operator {
public void setOperatorGroupFlag(String operatorGroupFlag) { public void setOperatorGroupFlag(String operatorGroupFlag) {
this.operatorGroupFlag = operatorGroupFlag; this.operatorGroupFlag = operatorGroupFlag;
} }
public String getOperatorGroupId() {
return operatorGroupId;
}
public void setOperatorGroupId(String operatorGroupId) {
this.operatorGroupId = operatorGroupId;
}
} }

4
src/main/java/com/xujie/sys/modules/production/service/impl/OperatorGroupServiceImpl.java

@ -49,9 +49,9 @@ public class OperatorGroupServiceImpl implements OperatorGroupService {
if(result.size()>0){ if(result.size()>0){
throw new RuntimeException("该操作组班次已经存在!!!"); throw new RuntimeException("该操作组班次已经存在!!!");
} }
Integer id =operatorGroupMapper.saveHeader(inData);
operatorGroupMapper.saveHeader(inData);
for (int i = 0; i <inData.getDetailList().size() ; i++) { for (int i = 0; i <inData.getDetailList().size() ; i++) {
inData.getDetailList().get(i).setPlanId(id);
inData.getDetailList().get(i).setPlanId(inData.getId());
} }
} }
operatorGroupMapper.deleteDetail(inData); operatorGroupMapper.deleteDetail(inData);

21
src/main/resources/mapper/production/OperatorGroupMapper.xml

@ -23,7 +23,7 @@
<select id="getOperatorGroupPlanHeader" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanHeaderData"> <select id="getOperatorGroupPlanHeader" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanHeaderData">
select a.Site,a.OperatorGroupId,a.WorkDate,a.Shiftno,a.allTime,a.WagesTime,a.id,b.OperatorName ,c.shiftdesc select a.Site,a.OperatorGroupId,a.WorkDate,a.Shiftno,a.allTime,a.WagesTime,a.id,b.OperatorName ,c.shiftdesc
from OperatorGroupPlanHeader a left join Operator b on a.OperatorGroupId=b.OperatorID
from OperatorGroupPlanHeader a left join Operator b on a.OperatorGroupId=b.OperatorID and a.site=b.site
left join ShiftInfo C on a.Shiftno=c.shiftno left join ShiftInfo C on a.Shiftno=c.shiftno
<where> <where>
<if test = "site != null and site != ''"> <if test = "site != null and site != ''">
@ -49,7 +49,7 @@
<select id="getOperatorGroupPlanDetail" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanDetailData"> <select id="getOperatorGroupPlanDetail" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanDetailData">
select a.PlanId,a.operatorID,a.workTime,a.WagesRate,a.Site,b.OperatorName select a.PlanId,a.operatorID,a.workTime,a.WagesRate,a.Site,b.OperatorName
from OperatorGroupPlanDetail a left join Operator b on a.operatorID=b.OperatorID
from OperatorGroupPlanDetail a left join Operator b on a.operatorID=b.OperatorID and a.site=b.site
<where> <where>
<if test = "site != null and site != ''"> <if test = "site != null and site != ''">
AND a.Site LIKE #{site} AND a.Site LIKE #{site}
@ -65,29 +65,30 @@
</select> </select>
<select id="getOperatorGroupDefault" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanDetailData"> <select id="getOperatorGroupDefault" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanDetailData">
select a.Member_OperatorID OperatorID,b.operatorName,null as workTime ,1 as WagesRate
from Operator_group_member a left join Operator b on a.Member_OperatorID=b.OperatorID
where a.OperatorID =#{operatorID} and b.Active='Y'
select a.site, a.Member_OperatorID OperatorID,b.operatorName,null as workTime ,1 as WagesRate
from Operator_group_member a left join Operator b on a.Member_OperatorID=b.OperatorID and a.site=b.site
where a.OperatorID =#{operatorGroupId} and b.Active='Y' and a.site=#{site}
</select> </select>
<select id="updateHeader" > <select id="updateHeader" >
update OperatorGroupPlanHeader set allTime=#{allTime,jdbcType=DOUBLE} and WagesTime=#{wagesTime,javaType=double}
update OperatorGroupPlanHeader set allTime=#{allTime,jdbcType=DOUBLE} , WagesTime=#{wagesTime,javaType=double}
where id=#{id} where id=#{id}
</select> </select>
<select id="checkHeader" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanHeaderData"> <select id="checkHeader" resultType="com.xujie.sys.modules.production.data.OperatorGroupPlanHeaderData">
select id from OperatorGroupPlanHeader where operatorID=#{operatorGroupId} and shiftno=#{shiftno}
select id from OperatorGroupPlanHeader where OperatorGroupId=#{operatorGroupId} and shiftno=#{shiftno}
and workDate=#{workDate}
</select> </select>
<insert id="saveHeader" keyProperty="id">
<insert id="saveHeader" useGeneratedKeys="true" keyProperty="id">
insert into OperatorGroupPlanHeader(Site,OperatorGroupId,WorkDate,Shiftno,allTime,WagesTime) insert into OperatorGroupPlanHeader(Site,OperatorGroupId,WorkDate,Shiftno,allTime,WagesTime)
values (#{site},#{operatorGroupId},#{workDate},#{shiftno},#{allTime},#{wagesTime} values (#{site},#{operatorGroupId},#{workDate},#{shiftno},#{allTime},#{wagesTime}
}
)
</insert> </insert>
<insert id="saveDetail"> <insert id="saveDetail">
insert into OperatorGroupPlanDetail(PlanId,operatorID,workTime,WagesRate,Site) insert into OperatorGroupPlanDetail(PlanId,operatorID,workTime,WagesRate,Site)
valuse(#{planId},#{operatorID},#{workTime},#{wagesRate},#{site})
values (#{planId},#{operatorID},#{workTime},#{wagesRate},#{site})
</insert> </insert>
<delete id="deleteDetail"> <delete id="deleteDetail">
delete from OperatorGroupPlanDetail where PlanId=#{id} delete from OperatorGroupPlanDetail where PlanId=#{id}

Loading…
Cancel
Save