| | |
| | | const user=userInfo() |
| | | //定义表头数据 |
| | | const titleUploadData = ref({ |
| | | reportingWorkId: null, |
| | | //流程卡号 |
| | | processId: 'NG24030804A02/1', |
| | | //销售单号 |
| | |
| | | |
| | | }) |
| | | |
| | | |
| | | let inputDisabled = ref(false) |
| | | onMounted(() =>{ |
| | | if(route.query.processId !== undefined && route.query.processId!=='' && route.query.processId!=null ){ |
| | | titleUploadData.value.processId = route.query.processId |
| | | } |
| | | // route.query.reportingWorkId = 'BG2403140039' |
| | | //判断是否传入报工编号 |
| | | if(route.query.reportingWorkId!== undefined && route.query.reportingWorkId!=='' && route.query.reportingWorkId!=null){ |
| | | if(route.query.reportingWorkId !== '' && route.query.reportingWorkId!=null){ |
| | | request.post(`reportingWork/selectUpdateReportingWork/${route.query.reportingWorkId}`).then(res=>{ |
| | | if(res.code === '200'){ |
| | | titleUploadData.value = res.data.reportingWork |
| | | console.log(res.data) |
| | | titleSelectJson.value = res.data.basic |
| | | xGrid.value.reloadData(res.data.reportingWorkDetails) |
| | | let button = { |
| | | code: 'update', |
| | | name: '修改', |
| | | status: 'primary', |
| | | } |
| | | gridOptions.toolbarConfig.buttons.push(button) |
| | | |
| | | |
| | | } |
| | | inputDisabled.value = true |
| | | }) |
| | | } |
| | | }) |
| | |
| | | |
| | | }) |
| | | |
| | | let brokenRow = ref() |
| | | let brokenRow = ref({ |
| | | glass_child:'', |
| | | order_number:'', |
| | | technology_number:'' |
| | | |
| | | }) |
| | | const gridEvents = { |
| | | async toolbarButtonClick({code}) { |
| | | const $grid = xGrid.value |
| | |
| | | ElMessage.error(`校验不通过!`) |
| | | return |
| | | } |
| | | saveReportingWork(0) |
| | | saveReportingWork(0,'save') |
| | | break |
| | | } |
| | | case 'saveReportingWorkReview': { |
| | |
| | | ElMessage.error(`校验不通过!`) |
| | | return |
| | | } |
| | | saveReportingWork(1) |
| | | saveReportingWork(1,'save') |
| | | break |
| | | } |
| | | case 'update': { |
| | | const errMap = await $grid.validate(true) |
| | | if (errMap) { |
| | | ElMessage.error(`校验不通过!`) |
| | | return |
| | | } |
| | | saveReportingWork(0,'update') |
| | | break |
| | | } |
| | | } |
| | |
| | | }) |
| | | |
| | | let reportingWorkNum = isNaN(brokenRow.value.completedQuantity*1)?0:brokenRow.value.completedQuantity*1 |
| | | if((breakageQuantityCount+reportingWorkNum>brokenRow.value.quantity*1) ){ |
| | | if((breakageQuantityCount>brokenRow.value.quantity*1) ){ |
| | | ElMessage.warning(`损耗数:'${breakageQuantityCount}' |
| | | 完工数:'${reportingWorkNum}'之和${breakageQuantityCount+reportingWorkNum} |
| | | 不能大于${brokenRow.value.quantity*1}`) |
| | | return false |
| | | } |
| | | |
| | | brokenRow.value.completedQuantity = brokenRow.value.quantity-breakageQuantityCount |
| | | breakageQuantityCount = breakageQuantityCount === 0 ? null : breakageQuantityCount |
| | | brokenRow.value.breakageQuantity = breakageQuantityCount |
| | | brokenRow.value.damageDetails=brokenGrid.value.getTableData().fullData |
| | | // xGrid.value.getTableData().fullData.forEach( |
| | | // |
| | | // ) |
| | | const equalByOrderNum = xGrid.value.getTableData().fullData.filter((row) =>{ |
| | | return row.order_number === brokenRow.value.order_number |
| | | }) |
| | | const maxQuantity = Math.max(...equalByOrderNum.map(item =>item.breakageQuantity || 0)) |
| | | console.log(maxQuantity) |
| | | equalByOrderNum.forEach((row) =>{ |
| | | row.completedQuantity= brokenRow.value.quantity*1-maxQuantity |
| | | }) |
| | | |
| | | |
| | | getQuantity() |
| | | |
| | | done() |
| | | } |
| | | |
| | |
| | | } |
| | | }) |
| | | |
| | | const saveReportingWork = (type) => { |
| | | const saveReportingWork = (state,saveType) => { |
| | | |
| | | if(xGrid.value.getTableData().fullData.length===0){ |
| | | ElMessage.warning(`请选择流程卡数据`) |
| | |
| | | const requestData = { |
| | | title:titleUploadData.value, |
| | | detail:xGrid.value.getTableData().fullData, |
| | | type:type//审核状态 |
| | | type:state//审核状态 |
| | | } |
| | | gridOptions.toolbarConfig.buttons[0].disabled=true |
| | | gridOptions.toolbarConfig.buttons[1].disabled=true |
| | | if(saveType==='save'){ |
| | | saveReportingWorkRequest(requestData) |
| | | }else{ |
| | | updateReportingWorkRequest(requestData) |
| | | } |
| | | |
| | | } |
| | | |
| | | const saveReportingWorkRequest = (requestData) =>{ |
| | | request.post(`/reportingWork/saveReportingWork`,requestData).then(res =>{ |
| | | if (res.code == 200){ |
| | | ElMessage.success("报工成功") |
| | |
| | | }else{ |
| | | const errorObj = JSON.parse(res.msg) |
| | | const msg = "序号:"+errorObj.orderNumber+'\n' |
| | | +'小片顺序:'+errorObj.technologyNumber+'\n' |
| | | +"实际可报工数量:"+errorObj.processNum+'<'+ |
| | | "报工数量:"+errorObj.sumNum+'\n' |
| | | +"请刷新界面重新报工" |
| | | +'小片顺序:'+errorObj.technologyNumber+'\n' |
| | | +"实际可报工数量:"+errorObj.processNum+'<'+ |
| | | "报工数量:"+errorObj.sumNum+'\n' |
| | | +"请刷新界面重新报工" |
| | | |
| | | ElMessage.error(msg) |
| | | } |
| | | }).catch(err =>{ |
| | | ElMessage.error(err.message) |
| | | }).finally(()=>{ |
| | | |
| | | gridOptions.toolbarConfig.buttons[0].disabled=false |
| | | gridOptions.toolbarConfig.buttons[1].disabled=false |
| | | }) |
| | | } |
| | | |
| | | //更新报工数据 |
| | | const updateReportingWorkRequest = (requestData) =>{ |
| | | request.post(`/reportingWork/updateReportingWork`,requestData).then(res =>{ |
| | | if (res.code == 200){ |
| | | ElMessage.success("报工修改成功") |
| | | router.push({path:'/main/reportingWorks/AddReportingWork', |
| | | query:{ |
| | | processId:titleUploadData.value.processId, |
| | | random:Math.random()} |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | const getWork = () => { |
| | | |
| | | let processId = titleUploadData.value.processId |
| | | if (processId.indexOf("/") < 0) { |
| | | |
| | | ElMessage.warning("请输入正确格式流程卡") |
| | | return |
| | | } |
| | | let indexOfChar = processId.indexOf("/") |
| | | let leftString = processId.slice(0, indexOfChar) |
| | | if (leftString.length != 13) { |
| | | ElMessage.warning("请输入正确位数的流程卡") |
| | | return |
| | | } |
| | | // if (processId.indexOf("/") < 0) { |
| | | // |
| | | // ElMessage.warning("请输入正确格式流程卡") |
| | | // return |
| | | // } |
| | | // let indexOfChar = processId.indexOf("/") |
| | | // let leftString = processId.slice(0, indexOfChar) |
| | | // if (leftString.length != 13) { |
| | | // ElMessage.warning("请输入正确位数的流程卡") |
| | | // return |
| | | // } |
| | | //工序 |
| | | let process = titleUploadData.value.thisProcess |
| | | if (process == "" || process == null) { |
| | |
| | | item.completedQuantity=row.completedQuantity |
| | | } |
| | | }) |
| | | getQuantity() |
| | | } |
| | | } |
| | | const getQuantity = () => { |
| | | const arr = xGrid.value.getTableData().fullData |
| | | const returnArr = arr.filter((obj, index, self) => |
| | | self.findIndex((t) => t.order_number === obj.order_number) === index |
| | | ) |
| | | |
| | | |
| | | let sumBreak = 0 |
| | | let sumQuantity = 0 |
| | | returnArr.forEach((item)=>{ |
| | | sumQuantity+=Number(item.completedQuantity*1) |
| | | }) |
| | | arr.forEach((item)=>{ |
| | | sumBreak+=Number(item.breakageQuantity) || 0 |
| | | }) |
| | | titleUploadData.value.thisCompletedQuantity = sumQuantity |
| | | titleUploadData.value.thisWornQuantity = sumBreak |
| | | } |
| | | |
| | | </script> |
| | |
| | | <template> |
| | | <div style="height: 100%;width: 100%"> |
| | | <div id="head" style="height: 5%;width: 100%;margin-bottom: 5px"> |
| | | <el-input v-model="titleUploadData.processId" placeholder="流程卡号" style="width: 200px" @keyup.enter.native="getWork"/> |
| | | <el-input :disabled="inputDisabled" v-if="titleUploadData.reportingWorkId" v-model="titleUploadData.reportingWorkId" placeholder="报工编号" style="width: 200px" /> |
| | | <el-input :disabled="inputDisabled" v-model="titleUploadData.processId" placeholder="流程卡号" style="width: 200px" @keyup.enter.native="getWork"/> |
| | | |
| | | <el-select v-model="titleUploadData.thisProcess" clearable placeholder="请选择工序" style="width: 120px" |
| | | <el-select :disabled="inputDisabled" v-model="titleUploadData.thisProcess" clearable placeholder="请选择工序" style="width: 120px" |
| | | @change="getWork"> |
| | | <el-option |
| | | v-for="item in titleSelectJson['processType']" |
| | |
| | | v-model="brokenVisible" |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false" |
| | | :title="$t('reportingWorks.damageList')" |
| | | :title="$t('reportingWorks.damageList')+':' |
| | | +brokenRow.glass_child+'.'+brokenRow.order_number+'.'+brokenRow.technology_number" |
| | | style="width: 80%;height:75% "> |
| | | <vxe-grid |
| | | |
| | |
| | | if(res.code==200){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | if(state==2){ |
| | | ElMessage.success(t('basicData.msg.reviewSuccess')) |
| | | ElMessage.success(t('basicData.msg.ReviewSuccess')) |
| | | }else if (state==0){ |
| | | ElMessage.success(t('basicData.msg.cancelReviewSuccess')) |
| | | } |
| | |
| | | public Result SelectUpdateReportingWork(@PathVariable String reportingWorkId) { |
| | | return Result.seccess(reportingWorkService.selectUpdateReportingWorkSv(reportingWorkId)); |
| | | } |
| | | |
| | | @ApiOperation("报工修改") |
| | | @PostMapping ("/updateReportingWork") |
| | | public Result updateReportingWork(@RequestBody Map<String,Object> reportingWork) { |
| | | return Result.seccess(reportingWorkService.updateReportingWork(reportingWork)); |
| | | } |
| | | |
| | | } |
| | |
| | | //类型 |
| | | private String breakageType; |
| | | //可利用 |
| | | private Integer available; |
| | | private Boolean available; |
| | | //退回工序 |
| | | private String returnProcess; |
| | | //责任工序 |
| | |
| | | //本工序 |
| | | private String thisProcess; |
| | | //上工序数量 |
| | | private Integer thisProcessQuantity; |
| | | private int thisProcessQuantity; |
| | | //本工序完工数量 |
| | | private Integer thisCompletedQuantity; |
| | | private int thisCompletedQuantity; |
| | | //本工序次破数量 |
| | | private Integer thisWornQuantity; |
| | | private int thisWornQuantity; |
| | | //下工序 |
| | | private String nextProcess; |
| | | //班次 |
| | |
| | | @Param("sDate") String startTime,@Param("eDate") String endTime,ReportingWorkDetail reportingWorkDetail); |
| | | |
| | | |
| | | List<ReportingWorkDetail> selectByreportingWorkId(String reportingWorkId); |
| | | } |
| | |
| | | int selectGlassProcessNum(String orderNumber, String technologyNumber, String processId, String thisProcess); |
| | | |
| | | int selectFlowCardNum(String orderNumber, String technologyNumber, String processId, String thisProcess); |
| | | |
| | | List<Map<String,Object>> selectByReportingWorkId(String reportingWorkId,String nextProcess); |
| | | } |
| | |
| | | @DS("sd") |
| | | public interface OrderProcessDetailMapper extends BaseMapper<OrderProcessDetail> { |
| | | boolean insertOrderProcessDetail(@Param("processDetailList") List<OrderProcessDetail> processDetailList); |
| | | |
| | | void updateQuantity(String reportingWorkId,String process,String type); |
| | | } |
| | |
| | | } |
| | | //主表插入 |
| | | reportingWorkMapper.insert(reportingWork); |
| | | |
| | | //副表循环插入,并且插入次破信息表。再根据次破信息修改订单玻璃流程表的完工数量与刺破数量 |
| | | reportingWorkDetails.forEach(reportingWorkDetail -> { |
| | | // reportingWork.setThisProcessQuantity( |
| | | // reportingWork.getThisProcessQuantity() |
| | | // +reportingWorkDetail.getCompletedQuantity() |
| | | // +reportingWorkDetail.getBreakageQuantity()); |
| | | // reportingWork.setThisCompletedQuantity( |
| | | // reportingWork.getThisCompletedQuantity()+reportingWorkDetail.getCompletedQuantity()); |
| | | // reportingWork.setThisWornQuantity( |
| | | // reportingWork.getThisWornQuantity()+reportingWorkDetail.getBreakageQuantity()); |
| | | |
| | | |
| | | reportingWorkDetail.setReportingWorkId(reportingWorkId); |
| | | List<DamageDetails> damageDetails = reportingWorkDetail.getDamageDetails(); |
| | | //次破明细表插入数据 |
| | | if(damageDetails!=null && !damageDetails.isEmpty()){ |
| | | damageDetails.forEach(damageDetail ->{ |
| | | damageDetail.setReportingWorkId(reportingWorkId); |
| | |
| | | |
| | | |
| | | }); |
| | | |
| | | return true; |
| | | } |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | //报工修改查询 |
| | | public Map<String,Object> selectUpdateReportingWorkSv(String reportingWorkId) { |
| | | //查询报工主表信息 |
| | | ReportingWork reportingWork =reportingWorkMapper.selectOne(new LambdaQueryWrapper<ReportingWork>() |
| | | .eq(ReportingWork::getReportingWorkId,reportingWorkId)); |
| | | //根据报工信息查询订单主表信息 |
| | | reportingWork.setOrder( |
| | | orderMapper.selectOne(new LambdaQueryWrapper<Order>() |
| | | .eq(Order::getOrderId,reportingWork.getOrderId()))); |
| | | reportingWork.setFlowCard(new FlowCard()); |
| | | |
| | | List<ReportingWorkDetail> reportingWorkDetails = reportingWorkDetailMapper.selectByreportingWorkId(reportingWorkId); |
| | | List<Map<String,Object>> reportingWorkDetails = reportingWorkMapper.selectByReportingWorkId(reportingWorkId,reportingWork.getNextProcess()); |
| | | reportingWorkDetails.forEach(reportingWorkDetail ->{ |
| | | List<DamageDetails> damageDetailsList = new ArrayList<>(); |
| | | damageDetailsList = damageDetailsMapper.selectList(new LambdaQueryWrapper<DamageDetails>() |
| | | .eq(DamageDetails::getReportingWorkId,reportingWorkId) |
| | | .eq(DamageDetails::getOrderNumber,reportingWorkDetail.get("order_number")) |
| | | .eq(DamageDetails::getTechnologyNumber,reportingWorkDetail.get("technology_number")) |
| | | ); |
| | | reportingWorkDetail.put("damageDetails",damageDetailsList); |
| | | }); |
| | | |
| | | |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("reportingWork",reportingWork); |
| | | map.put("reportingWorkDetails",reportingWorkDetails); |
| | | map.put("basic",getReportingWorkBase(reportingWork.getProcessId(),reportingWork.getThisProcess())); |
| | | |
| | | |
| | | |
| | | return map; |
| | | |
| | | } |
| | | |
| | | private Map<String,Object> getReportingWorkBase(String processId, String thisProcess) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | //设备下拉框 |
| | | map.put("deviceType", reportingWorkMapper.SelectWorkBasicDeviceMp(thisProcess)); |
| | | //班组下拉框 |
| | | map.put("teamsType", reportingWorkMapper.SelectWorkBasicTeamsMp(thisProcess)); |
| | | |
| | | map.put("breakageType",reportingWorkMapper.selectBasicNameByType("breakagetype")); |
| | | map.put("breakageReason",reportingWorkMapper.selectBasicNameByType("breakagereason")); |
| | | |
| | | //获取该流程卡号历史报工工序 |
| | | String historyProcess =reportingWorkMapper.historyProcessMp(processId); |
| | | //历史报工工序设备 |
| | | map.put("historyDevice",reportingWorkMapper.historyDeviceMp(historyProcess,thisProcess)); |
| | | //历史报工工序班组 |
| | | map.put("historyTeams",reportingWorkMapper.historyTeamsMp(processId,thisProcess)); |
| | | //历史工序 |
| | | map.put("historyProcess",reportingWorkMapper.SelectHistoryProcessMp(historyProcess,thisProcess)); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | //报工修改 |
| | | public Boolean updateReportingWork(Map<String, Object> reportingWorkMap) { |
| | | //接收解析主附表信息 |
| | | JSONObject reportingWorkJson = new JSONObject(reportingWorkMap); |
| | | ReportingWork reportingWork = JSONObject.parseObject(JSONObject.toJSONString(reportingWorkJson.get("title")), ReportingWork.class); |
| | | List<ReportingWorkDetail> reportingWorkDetails = JSONArray.parseArray(JSONObject.toJSONString(reportingWorkJson.get("detail")), ReportingWorkDetail.class); |
| | | //删除刺破明细表刺破数据 |
| | | damageDetailsMapper.delete( |
| | | new LambdaQueryWrapper<DamageDetails>() |
| | | .eq(DamageDetails::getReportingWorkId,reportingWork.getReportingWorkId()) |
| | | ); |
| | | //修改小片流程表数量 |
| | | orderProcessDetailMapper.updateQuantity(reportingWork.getReportingWorkId(),reportingWork.getThisProcess(),"delete"); |
| | | //删除报工明细表数据 |
| | | reportingWorkDetailMapper |
| | | .delete(new LambdaQueryWrapper<ReportingWorkDetail>() |
| | | .eq(ReportingWorkDetail::getReportingWorkId,reportingWork.getReportingWorkId())); |
| | | |
| | | //更细报工主表 |
| | | reportingWorkMapper.updateById(reportingWork); |
| | | reportingWorkDetails.forEach(reportingWorkDetail->{ |
| | | List<DamageDetails> damageDetails = reportingWorkDetail.getDamageDetails(); |
| | | //每一条报工数据循环插入次破明细表 |
| | | if(damageDetails!=null && !damageDetails.isEmpty()){ |
| | | damageDetails.forEach(damageDetailsMapper::insert); |
| | | } |
| | | //插入报工数据 |
| | | reportingWorkDetailMapper.insert(reportingWorkDetail); |
| | | }); |
| | | //修改小片流程表数量为报工明细表数量 |
| | | orderProcessDetailMapper.updateQuantity(reportingWork.getReportingWorkId(),reportingWork.getThisProcess(),"add"); |
| | | return true; |
| | | } |
| | | } |
| | |
| | | ogd.child_height, |
| | | od.shape, |
| | | fc.quantity -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity, |
| | | fc.quantity -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as completedQuantity, |
| | | odpd.reporting_work_num_count as completed, |
| | | odpd.broken_num as onceBroken |
| | | FROM |
| | |
| | | ogd.child_height, |
| | | od.shape, |
| | | odpds.reporting_work_num -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity, |
| | | odpds.reporting_work_num -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as completedQuantity, |
| | | odpd.reporting_work_num_count as completed, |
| | | odpd.broken_num as onceBroken, |
| | | ogd.`group` |
| | |
| | | and a.order_number = #{orderNumber} |
| | | and a.technology_number = #{technologyNumber} |
| | | </select> |
| | | |
| | | <!--查询修改报工明细数据--> |
| | | <select id="selectByReportingWorkId" > |
| | | select |
| | | a.reporting_work_id, |
| | | d.order_number, |
| | | d.glass_child, |
| | | d.technology_number, |
| | | d.glass_address, |
| | | c.quantity as quantity_card, |
| | | d.child_width, |
| | | d.child_height, |
| | | e.shape, |
| | | a.completed_quantity+a.breakage_quantity as 'quantity', -- 可报工数 |
| | | a.completed_quantity as 'completedQuantity', -- 完工数 |
| | | a.breakage_quantity as 'breakageQuantity', -- 破损数 |
| | | f.completed_quantity as thisQuantitySum ,-- 本工序完工和 |
| | | <if test="nextProcess != null and nextProcess != ''"> -- 非最后一道工序 |
| | | ifnull(g.completed_quantity,0) as nextQuantitySum, -- 后工序已完成 |
| | | if((f.completed_quantity |
| | | -ifnull(g.completed_quantity,0)) |
| | | >= |
| | | a.completed_quantity, |
| | | 0, |
| | | (a.completed_quantity-f.completed_quantity |
| | | +ifnull(g.completed_quantity,0)) |
| | | ) as minQuantity -- 修改最小数 |
| | | </if> |
| | | <if test="nextProcess == null or nextProcess == ''"> -- 最后一道工序 |
| | | c.received_quantity, -- 已入库数量 |
| | | c.inventory_quantity, -- 库存数量 |
| | | if(ifnull(inventory_quantity,0) |
| | | -ifnull(c.received_quantity,0) |
| | | >= a.completed_quantity,0, |
| | | (a.completed_quantity-(ifnull(c.inventory_quantity,0) |
| | | -ifnull(c.received_quantity,0))) |
| | | ) |
| | | as minQuantity -- 修改最小数 |
| | | </if> |
| | | -- e.thisQuantitySum |
| | | from |
| | | reporting_work_detail as a |
| | | left join reporting_work as b |
| | | on a.reporting_work_id = b.reporting_work_id |
| | | left join flow_card as c |
| | | on c.process_id = b.process_id |
| | | and c.technology_number = a.technology_number |
| | | left join sd.order_glass_detail as d |
| | | on d.order_id = c.order_id |
| | | and c.order_number = d.order_number |
| | | and d.technology_number = c.technology_number |
| | | left join sd.order_detail as e |
| | | on e.order_id = d.order_id and e.order_number = d.order_number |
| | | |
| | | left join (select sum(completed_quantity) as completed_quantity , |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | rwd.technology_number, |
| | | rw.this_process |
| | | from reporting_work as rw |
| | | left join reporting_work_detail as rwd |
| | | on rw.reporting_work_id = rwd.reporting_work_id |
| | | group by rw.process_id, |
| | | rw.this_process, |
| | | rwd.order_number, |
| | | rwd.technology_number |
| | | ) as f |
| | | on f.process_id = b.process_id |
| | | and f.this_process = b.this_process |
| | | and f.order_number = a.order_number |
| | | and f.technology_number = a.technology_number |
| | | <if test="nextProcess != null and nextProcess != ''"> |
| | | left join (select ifnull(sum(completed_quantity),0) as completed_quantity , |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | rwd.technology_number, |
| | | rw.this_process |
| | | from reporting_work as rw |
| | | left join reporting_work_detail as rwd |
| | | on rw.reporting_work_id = rwd.reporting_work_id |
| | | group by rw.process_id, |
| | | rw.this_process, |
| | | rwd.order_number, |
| | | rwd.technology_number |
| | | ) as g |
| | | on g.process_id = b.process_id |
| | | and g.this_process = b.next_process |
| | | and g.order_number = a.order_number |
| | | and g.technology_number = a.technology_number |
| | | </if> |
| | | where a.reporting_work_id = #{reportingWorkId} |
| | | </select> |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | |
| | | |
| | | <!--查询detail明细--> |
| | | <select id="reportingWorkId"> |
| | | select * from reporting_work_detail |
| | |
| | | |
| | | |
| | | </insert> |
| | | <update id="updateQuantity"> |
| | | update sd.order_process_detail as a |
| | | inner join |
| | | (select |
| | | rwd.completed_quantity, |
| | | rwd.breakage_quantity, |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | rwd.technology_number |
| | | from pp.reporting_work_detail as rwd |
| | | left join pp.reporting_work as rw |
| | | on rwd.reporting_work_id = rw.reporting_work_id |
| | | where rwd.reporting_work_id =#{reportingWorkId} ) as b |
| | | on a.process_id = b.process_id |
| | | and a.order_number = b.order_number |
| | | and a.technology_number = b.technology_number |
| | | |
| | | <if test="type == 'delete'"> |
| | | set a.reporting_work_num_count |
| | | = a.reporting_work_num_count-b.completed_quantity, |
| | | |
| | | a.reporting_work_num |
| | | = a.reporting_work_num-b.completed_quantity, |
| | | |
| | | a.broken_num |
| | | = a.broken_num-b.breakage_quantity |
| | | </if> |
| | | |
| | | <if test="type == 'add'"> |
| | | set a.reporting_work_num_count |
| | | = a.reporting_work_num_count+b.completed_quantity, |
| | | |
| | | a.reporting_work_num |
| | | = a.reporting_work_num+b.completed_quantity, |
| | | |
| | | a.broken_num |
| | | = a.broken_num+b.breakage_quantity |
| | | </if> |
| | | |
| | | where a.process = #{process} |
| | | |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | ogd.child_height, |
| | | od.shape, |
| | | fc.quantity -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity, |
| | | fc.quantity -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as completedQuantity, |
| | | odpd.reporting_work_num_count as completed, |
| | | odpd.broken_num as onceBroken |
| | | FROM |
| | |
| | | ogd.child_height, |
| | | od.shape, |
| | | odpds.reporting_work_num -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity, |
| | | odpds.reporting_work_num -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as completedQuantity, |
| | | odpd.reporting_work_num_count as completed, |
| | | odpd.broken_num as onceBroken, |
| | | ogd.`group` |
| | |
| | | and a.order_number = #{orderNumber} |
| | | and a.technology_number = #{technologyNumber} |
| | | </select> |
| | | |
| | | <!--查询修改报工明细数据--> |
| | | <select id="selectByReportingWorkId" > |
| | | select |
| | | a.reporting_work_id, |
| | | d.order_number, |
| | | d.glass_child, |
| | | d.technology_number, |
| | | d.glass_address, |
| | | c.quantity as quantity_card, |
| | | d.child_width, |
| | | d.child_height, |
| | | e.shape, |
| | | a.completed_quantity+a.breakage_quantity as 'quantity', -- 可报工数 |
| | | a.completed_quantity as 'completedQuantity', -- 完工数 |
| | | a.breakage_quantity as 'breakageQuantity', -- 破损数 |
| | | f.completed_quantity as thisQuantitySum ,-- 本工序完工和 |
| | | <if test="nextProcess != null and nextProcess != ''"> -- 非最后一道工序 |
| | | ifnull(g.completed_quantity,0) as nextQuantitySum, -- 后工序已完成 |
| | | if((f.completed_quantity |
| | | -ifnull(g.completed_quantity,0)) |
| | | >= |
| | | a.completed_quantity, |
| | | 0, |
| | | (a.completed_quantity-f.completed_quantity |
| | | +ifnull(g.completed_quantity,0)) |
| | | ) as minQuantity1 -- 修改最小数 |
| | | </if> |
| | | <if test="nextProcess == null or nextProcess == ''"> -- 最后一道工序 |
| | | c.received_quantity, -- 已入库数量 |
| | | c.inventory_quantity, -- 库存数量 |
| | | if(ifnull(inventory_quantity,0) |
| | | -ifnull(c.received_quantity,0) |
| | | >= a.completed_quantity,0, |
| | | (a.completed_quantity-(ifnull(c.inventory_quantity,0) |
| | | -ifnull(c.received_quantity,0))) |
| | | ) |
| | | as minQuantity2 -- 修改最小数 |
| | | </if> |
| | | -- e.thisQuantitySum |
| | | from |
| | | reporting_work_detail as a |
| | | left join reporting_work as b |
| | | on a.reporting_work_id = b.reporting_work_id |
| | | left join flow_card as c |
| | | on c.process_id = b.process_id |
| | | and c.technology_number = a.technology_number |
| | | left join sd.order_glass_detail as d |
| | | on d.order_id = c.order_id |
| | | and c.order_number = d.order_number |
| | | and d.technology_number = c.technology_number |
| | | left join sd.order_detail as e |
| | | on e.order_id = d.order_id and e.order_number = d.order_number |
| | | |
| | | left join (select sum(completed_quantity) as completed_quantity , |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | rwd.technology_number, |
| | | rw.this_process |
| | | from reporting_work as rw |
| | | left join reporting_work_detail as rwd |
| | | on rw.reporting_work_id = rwd.reporting_work_id |
| | | group by rw.process_id, |
| | | rw.this_process, |
| | | rwd.order_number, |
| | | rwd.technology_number |
| | | ) as f |
| | | on f.process_id = b.process_id |
| | | and f.this_process = b.this_process |
| | | and f.order_number = a.order_number |
| | | and f.technology_number = a.technology_number |
| | | <if test="nextProcess != null and nextProcess != ''"> |
| | | left join (select ifnull(sum(completed_quantity),0) as completed_quantity , |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | rwd.technology_number, |
| | | rw.this_process |
| | | from reporting_work as rw |
| | | left join reporting_work_detail as rwd |
| | | on rw.reporting_work_id = rwd.reporting_work_id |
| | | group by rw.process_id, |
| | | rw.this_process, |
| | | rwd.order_number, |
| | | rwd.technology_number |
| | | ) as g |
| | | on g.process_id = b.process_id |
| | | and g.this_process = b.next_process |
| | | and g.order_number = a.order_number |
| | | and g.technology_number = a.technology_number |
| | | </if> |
| | | where a.reporting_work_id = #{reportingWorkId} |
| | | </select> |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | |
| | | |
| | | <!--查询detail明细--> |
| | | <select id="reportingWorkId"> |
| | | select * from reporting_work_detail |
| | |
| | | |
| | | |
| | | </insert> |
| | | <update id="updateQuantity"> |
| | | update sd.order_process_detail as a |
| | | inner join |
| | | (select |
| | | rwd.completed_quantity, |
| | | rwd.breakage_quantity, |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | rwd.technology_number |
| | | from pp.reporting_work_detail as rwd |
| | | left join pp.reporting_work as rw |
| | | on rwd.reporting_work_id = rw.reporting_work_id |
| | | where rwd.reporting_work_id =#{reportingWorkId} ) as b |
| | | on a.process_id = b.process_id |
| | | and a.order_number = b.order_number |
| | | and a.technology_number = b.technology_number |
| | | |
| | | <if test="type == 'delete'"> |
| | | set a.reporting_work_num_count |
| | | = a.reporting_work_num_count-b.completed_quantity, |
| | | |
| | | a.reporting_work_num |
| | | = a.reporting_work_num-b.completed_quantity, |
| | | |
| | | a.broken_num |
| | | = a.broken_num-b.breakage_quantity |
| | | </if> |
| | | |
| | | <if test="type == 'add'"> |
| | | set a.reporting_work_num_count |
| | | = a.reporting_work_num_count+b.completed_quantity, |
| | | |
| | | a.reporting_work_num |
| | | = a.reporting_work_num+b.completed_quantity, |
| | | |
| | | a.broken_num |
| | | = a.broken_num+b.breakage_quantity |
| | | </if> |
| | | |
| | | where a.process = #{process} |
| | | |
| | | </update> |
| | | |
| | | </mapper> |