|  |  |  | 
|---|
|  |  |  | <NumberField source="purQty" label="table.field.asnOrderItem.purQty" /> | 
|---|
|  |  |  | <TextField source="purUnit" label="table.field.asnOrderItem.purUnit" /> | 
|---|
|  |  |  | <NumberField source="qty" label="table.field.asnOrderItem.qty" /> | 
|---|
|  |  |  | <NumberField source="safeQty" label="table.field.asnOrderItem.safeQty" /> | 
|---|
|  |  |  | {/* <NumberField source="safeQty" label="table.field.asnOrderItem.safeQty" /> | 
|---|
|  |  |  | <NumberField source="disQty" label="table.field.asnOrderItem.disQty" /> | 
|---|
|  |  |  | <TextField source="isptResult$" label="table.field.asnOrderItem.isptResult" /> | 
|---|
|  |  |  | <TextField source="isptResult$" label="table.field.asnOrderItem.isptResult" /> */} | 
|---|
|  |  |  | <TextField source="splrCode" label="table.field.asnOrderItem.splrCode" /> | 
|---|
|  |  |  | <TextField source="splrName" label="table.field.asnOrderItem.splrName" /> | 
|---|
|  |  |  | <TextField source="qrcode" label="table.field.asnOrderItem.qrcode" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | aria-labelledby="form-dialog-title" | 
|---|
|  |  |  | fullWidth | 
|---|
|  |  |  | disableRestoreFocus | 
|---|
|  |  |  | maxWidth="md" | 
|---|
|  |  |  | maxWidth="lg" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <DialogTitle id="form-dialog-title" sx={{ | 
|---|
|  |  |  | position: 'sticky', | 
|---|
|  |  |  | 
|---|
|  |  |  | </DialogTitle> | 
|---|
|  |  |  | <EditBase | 
|---|
|  |  |  | resource="purchaseItem" | 
|---|
|  |  |  | id={record?.id} | 
|---|
|  |  |  | mutationMode={EDIT_MODE} | 
|---|
|  |  |  | actions={<CustomerTopToolBar />} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | 
|---|
|  |  |  | defaultValues={{}} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <DialogContent sx={{ mt: 2 }}> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <Grid container width={{ xs: '100%', xl: '100%' }} rowSpacing={3} columnSpacing={3}> | 
|---|
|  |  |  | <Grid item xs={12} md={8} gap={2}> | 
|---|
|  |  |  | <Grid item xs={16} md={10} gap={2}> | 
|---|
|  |  |  | <Typography variant="h6" gutterBottom> | 
|---|
|  |  |  | {translate('common.edit.title.main')} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | 
|---|
|  |  |  | validate={required()} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <NumberInput | 
|---|
|  |  |  | label="table.field.purchaseItem.asnQty" | 
|---|
|  |  |  | source="asnQty" | 
|---|
|  |  |  | validate={required()} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Stack> | 
|---|
|  |  |  | <Stack direction='row' gap={2}> | 
|---|
|  |  |  | <NumberInput | 
|---|
|  |  |  | label="table.field.purchaseItem.printQty" | 
|---|
|  |  |  | source="printQty" | 
|---|
|  |  |  | validate={required()} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Stack> | 
|---|
|  |  |  | <Stack direction='row' gap={2}> | 
|---|
|  |  |  | <TextInput | 
|---|
|  |  |  | label="table.field.purchaseItem.splrName" | 
|---|
|  |  |  | source="splrName" | 
|---|
|  |  |  | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Stack> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | <Grid item xs={12} md={4} > | 
|---|
|  |  |  | <Grid item xs={8} md={2} > | 
|---|
|  |  |  | <Typography variant="h6" gutterBottom> | 
|---|
|  |  |  | {translate('common.edit.title.common')} | 
|---|
|  |  |  | </Typography> | 
|---|
|  |  |  | 
|---|
|  |  |  | <FilterButton /> | 
|---|
|  |  |  | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> | 
|---|
|  |  |  | <SelectColumnsButton preferenceKey='purchaseItem' /> | 
|---|
|  |  |  | <MyExportButton /> | 
|---|
|  |  |  | {/* <MyExportButton /> */} | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | perPage={DEFAULT_PAGE_SIZE} | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Toolbar sx={{ justifyContent: 'end' }}> | 
|---|
|  |  |  | <SaveButton /> | 
|---|
|  |  |  | <DeleteButton mutationMode="optimistic" /> | 
|---|
|  |  |  | <></> | 
|---|
|  |  |  | </Toolbar> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | mode="onTouched" | 
|---|
|  |  |  | defaultValues={{}} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <Grid container width={{ xs: '100%', xl: '100%' }}> | 
|---|
|  |  |  | <Grid container width={{ xs: '100%', xl: '100%' }} sx={{ | 
|---|
|  |  |  | "& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled": { | 
|---|
|  |  |  | bgcolor: 'white', | 
|---|
|  |  |  | WebkitTextFillColor: "rgba(0, 0, 0)" | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | "& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled": { | 
|---|
|  |  |  | bgcolor: 'white', | 
|---|
|  |  |  | WebkitTextFillColor: "rgba(0, 0, 0)" | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | "& .MuiFilledInput-root.MuiInputBase-sizeSmall": { | 
|---|
|  |  |  | bgcolor: 'white', | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }}> | 
|---|
|  |  |  | <Grid item xs={24} md={12}> | 
|---|
|  |  |  | <Typography variant="h6" gutterBottom> | 
|---|
|  |  |  | {translate('common.edit.title.main')} | 
|---|
|  |  |  | 
|---|
|  |  |  | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> | 
|---|
|  |  |  | <TextField source="memo" label="common.field.memo" sortable={false} /> | 
|---|
|  |  |  | <WrapperField cellClassName="opt" label="common.field.opt"> | 
|---|
|  |  |  | <EditButton /> | 
|---|
|  |  |  | <EditButton label="toolbar.detail" /> | 
|---|
|  |  |  | <InspectionButton /> | 
|---|
|  |  |  | <CompleteButton /> | 
|---|
|  |  |  | <CloseButton /> | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | const DoneButton = (props) => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const clickComplete = (event) => { | 
|---|
|  |  |  | event.stopPropagation(); | 
|---|
|  |  |  | 
|---|
|  |  |  | cancleTask(record) | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | //取消任务 | 
|---|
|  |  |  | const cancleTask = async (row) => { | 
|---|
|  |  |  | const cancleTask = async (row) => { | 
|---|
|  |  |  | console.log(row); | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.post(`/task/remove/` + row.id); | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button | 
|---|
|  |  |  | onClick={clickCancel} | 
|---|
|  |  |  | label="toolbar.cancel"> | 
|---|
|  |  |  | <CancelIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | record.taskStatus === 1 ? | 
|---|
|  |  |  | <Button | 
|---|
|  |  |  | onClick={clickCancel} | 
|---|
|  |  |  | label="toolbar.cancel"> | 
|---|
|  |  |  | <CancelIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | : | 
|---|
|  |  |  | <></> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | stock.setAnfme(sum) | 
|---|
|  |  |  | .setSourceId(order.getId()) | 
|---|
|  |  |  | .setType(order.getType()) | 
|---|
|  |  |  | .setUpdateBy(loginUserId) | 
|---|
|  |  |  | .setCreateBy(loginUserId) | 
|---|
|  |  |  | .setWkType(Short.parseShort(order.getWkType())); | 
|---|
|  |  |  | if (!stockService.save(stock)) { | 
|---|
|  |  |  | throw new CoolException("库存保存失败!!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | .setId(null) | 
|---|
|  |  |  | .setLocCode(loc.getCode()) | 
|---|
|  |  |  | .setOrderId(order.getId()) | 
|---|
|  |  |  | .setUpdateBy(loginUserId) | 
|---|
|  |  |  | .setUpdateBy(loginUserId) | 
|---|
|  |  |  | .setOrderItemId(asnOrderItem.getId()) | 
|---|
|  |  |  | .setWkType(Short.parseShort(order.getWkType())) | 
|---|
|  |  |  | .setType(order.getType()); | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 编号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Excel(name = "*编号") | 
|---|
|  |  |  | @ApiModelProperty(value = "*编号") | 
|---|
|  |  |  | @Excel(name = "*ASN单号") | 
|---|
|  |  |  | @ApiModelProperty(value = "*ASN单号") | 
|---|
|  |  |  | @ExcelComment(value = "code", example = "ASN5945272236") | 
|---|
|  |  |  | private String code; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | public R excelImport(MultipartFile file, HashMap<String, Object> hashMap, Long loginUserId) throws Exception { | 
|---|
|  |  |  | public synchronized R excelImport(MultipartFile file, HashMap<String, Object> hashMap, Long loginUserId) throws Exception { | 
|---|
|  |  |  | ExcelImportResult result = ExcelImportUtil.importExcelMore(file.getInputStream(), AsnOrderTemplate.class, ExcelUtil.getDefaultImportParams()); | 
|---|
|  |  |  | if (result.getList().isEmpty()) { | 
|---|
|  |  |  | throw new CoolException("物料导入失败!!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.web.multipart.MultipartFile; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | PurchaseTemplate template = list.stream().findFirst().get(); | 
|---|
|  |  |  | Purchase purchase = new Purchase(); | 
|---|
|  |  |  | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | 
|---|
|  |  |  | Date date = dateFormat.parse(template.getArrTime()); | 
|---|
|  |  |  | BeanUtils.copyProperties(template, purchase); | 
|---|
|  |  |  | purchase.setCode(template.getPoCode()); | 
|---|
|  |  |  | if (StringUtils.isBlank(template.getPoCode())) { | 
|---|
|  |  |  | 
|---|
|  |  |  | purchase.setType(OrderType.getTypeVal(template.getType())) | 
|---|
|  |  |  | .setWkType(OrderWorkType.getWorkType(template.getWkType())) | 
|---|
|  |  |  | .setSource(OrderSourceType.ORDER_SOURCE_TYPE_EXCEL.desc) | 
|---|
|  |  |  | .setPreArr(date) | 
|---|
|  |  |  | .setCreateBy(loginUserId) | 
|---|
|  |  |  | .setUpdateBy(loginUserId); | 
|---|
|  |  |  | if (!purchaseService.save(purchase)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | .setPlatItemId(template.getPlatItemId()) | 
|---|
|  |  |  | .setAnfme(template.getAnfme()) | 
|---|
|  |  |  | .setPurchaseId(purchase.getId()) | 
|---|
|  |  |  | .setUnit(matnr.getUnit()) | 
|---|
|  |  |  | .setNromQty(matnr.getNromNum()) | 
|---|
|  |  |  | .setSplrBatch(template.getSplrBatch()) | 
|---|
|  |  |  | .setCreateBy(loginUserId) | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | double anfmes = items.stream().mapToDouble(PurchaseItem::getAnfme).sum(); | 
|---|
|  |  |  | double qty = items.stream().mapToDouble(PurchaseItem::getQty).sum(); | 
|---|
|  |  |  | purchase.setAnfme(anfmes).setQty(qty); | 
|---|
|  |  |  | purchase.setAnfme(anfmes); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!purchaseService.updateById(purchase)) { | 
|---|
|  |  |  | throw new CoolException("主单数量修改失败!!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | items.add(pakinItem); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | double sum1 = items.stream().mapToDouble(WaitPakinItem::getAnfme).sum(); | 
|---|
|  |  |  | 
|---|
|  |  |  | aoi.pur_unit, | 
|---|
|  |  |  | aoi.prod_time, | 
|---|
|  |  |  | aoi.qty, | 
|---|
|  |  |  | qii.safe_qty, | 
|---|
|  |  |  | qii.dis_qty, | 
|---|
|  |  |  | --                     qii.safe_qty, | 
|---|
|  |  |  | --                     qii.dis_qty, | 
|---|
|  |  |  | aoi.splr_code, | 
|---|
|  |  |  | aoi.splr_batch, | 
|---|
|  |  |  | aoi.splr_name, | 
|---|
|  |  |  | 
|---|
|  |  |  | aoi.pack_name, | 
|---|
|  |  |  | aoi.nty_status, | 
|---|
|  |  |  | aoi.`status`, | 
|---|
|  |  |  | CASE | 
|---|
|  |  |  | aoi.ispt_result | 
|---|
|  |  |  | WHEN 0 THEN | 
|---|
|  |  |  | '未检' | 
|---|
|  |  |  | WHEN 1 THEN | 
|---|
|  |  |  | '合格' | 
|---|
|  |  |  | WHEN 2 THEN | 
|---|
|  |  |  | '不合格' | 
|---|
|  |  |  | WHEN 3 THEN | 
|---|
|  |  |  | '待定' | 
|---|
|  |  |  | WHEN 4 THEN | 
|---|
|  |  |  | '部分合格' | 
|---|
|  |  |  | END AS isptResult$, | 
|---|
|  |  |  | --                     CASE | 
|---|
|  |  |  | --                         aoi.ispt_result | 
|---|
|  |  |  | --                         WHEN 0 THEN | 
|---|
|  |  |  | --                             '未检' | 
|---|
|  |  |  | --                         WHEN 1 THEN | 
|---|
|  |  |  | --                             '合格' | 
|---|
|  |  |  | --                         WHEN 2 THEN | 
|---|
|  |  |  | --                             '不合格' | 
|---|
|  |  |  | --                         WHEN 3 THEN | 
|---|
|  |  |  | --                             '待定' | 
|---|
|  |  |  | --                         WHEN 4 THEN | 
|---|
|  |  |  | --                             '部分合格' | 
|---|
|  |  |  | --                         END AS isptResult$, | 
|---|
|  |  |  | aoi.deleted, | 
|---|
|  |  |  | aoi.tenant_id, | 
|---|
|  |  |  | aoi.create_by, | 
|---|
|  |  |  | 
|---|
|  |  |  | aoi.memo | 
|---|
|  |  |  | FROM | 
|---|
|  |  |  | man_asn_order_item aoi | 
|---|
|  |  |  | LEFT JOIN man_qly_ispt_item qii ON aoi.id = qii.asn_item_id | 
|---|
|  |  |  | --                         LEFT JOIN man_qly_ispt_item qii ON aoi.id = qii.asn_item_id | 
|---|
|  |  |  | ) t | 
|---|
|  |  |  | ${ew.customSqlSegment} | 
|---|
|  |  |  | </select> | 
|---|