工单导入(未测)

main
暴炳林 2024-12-31 17:47:31 +08:00
parent 9515c69c2f
commit 024366cd21
4 changed files with 149 additions and 6 deletions

View File

@ -31,10 +31,6 @@ public interface ImportFileManager extends BaseManager{
@Transactional
void importASN(File file);
/**
*
* */
@Transactional
void importXBKPickTicket(File file);
@Transactional
@ -43,8 +39,18 @@ public interface ImportFileManager extends BaseManager{
void importHLX2PickTicket(File file);
@Transactional
void importPickTicket(File file,String type);
/**
*
* @param file
*/
@Transactional
void importItem(File file);
/**
*
* @param file
*/
@Transactional
void importPickTicketOrder(File file);
@Transactional
void importStoreLine(File file);

View File

@ -569,7 +569,8 @@ public class DefaultImportFileManager extends DefaultBaseManager implements Impo
}
}
private static SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");//小写的mm表示的是分钟
private static SimpleDateFormat sdfa=new SimpleDateFormat("YYYY-MM-DD HH:mm:ss");
public void importXBKPickTicket(File file){
try {
Workbook workbook = Workbook.getWorkbook(file);
@ -577,7 +578,6 @@ public class DefaultImportFileManager extends DefaultBaseManager implements Impo
if(sheet.getColumns()<16){
throw new BusinessException("该模版列数不正确不能小于16");
}
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");//小写的mm表示的是分钟
String hpdm1="";
Structure s=null;
String cusCode=CompanyCode.XBK;
@ -1528,4 +1528,107 @@ public class DefaultImportFileManager extends DefaultBaseManager implements Impo
}
@Override
public void importPickTicketOrder(File file) {
try {
Workbook workbook = Workbook.getWorkbook(file);
Sheet sheet = workbook.getSheet(0);// 得到excel第一页的内容
/* 查询单据类型*/
List<BillType> billTypes=commonDao.findByQuery(
"from BillType bt");
for (int i = 1; i <sheet.getRows(); i++) {
//料号 描述 包装数量 长(m) 宽(m) 高(m) 重量(KG) 包装类型 单位 中大物料标记
int j=0;
String sourceType=sheet.getCell(j++,i).getContents().trim();//出库类型
String code=sheet.getCell(j++,i).getContents().trim();//工单号
String orderDate1=sheet.getCell(j++,i).getContents().trim();//需求日期
String billTypeName=sheet.getCell(j++,i).getContents().trim();//单据类型
String status=sheet.getCell(j++,i).getContents().trim();//状态
String packageQuantity=sheet.getCell(j++,i).getContents().trim();//需求行数
String BOLQuantity=sheet.getCell(j++,i).getContents().trim();//完成行数
String orderQuantity=sheet.getCell(j++,i).getContents().trim();//需求数量
String allocatedQuantity=sheet.getCell(j++,i).getContents().trim();//预分配数量
String pickedQuantity=sheet.getCell(j++,i).getContents().trim();//拣货数量
String shippedQuantity=sheet.getCell(j++,i).getContents().trim();//发运数量
String relatedBill3=sheet.getCell(j++,i).getContents().trim();//头物料
String workerName1=sheet.getCell(j++,i).getContents().trim();//工厂
String printCount=sheet.getCell(j++,i).getContents().trim();//SAP状态
String priority=sheet.getCell(j++,i).getContents().trim();//SAP扣料
String updateTime1=sheet.getCell(j++,i).getContents().trim();//创建日期
String updateTime2=sheet.getCell(j++,i).getContents().trim();//创建时间
String relatedBill1=sheet.getCell(j++,i).getContents().trim();//SAP接口号
String relatedBill2=sheet.getCell(j++,i).getContents().trim();//关联号
String shipDateStart1=sheet.getCell(j++,i).getContents().trim();//SAP调整日期
String shipDateStart2=sheet.getCell(j++,i).getContents().trim();//SAP调整时间
String lictrailer=sheet.getCell(j++,i).getContents().trim();//头物料描述
String logisticsCompany=sheet.getCell(j++,i).getContents().trim();//工作中心
String driverName=sheet.getCell(j++,i).getContents().trim();//关联号
String userName=sheet.getCell(j++,i).getContents().trim();//创建人
PickTicket pickTicket=new PickTicket();
List<PickTicket> pickTickets=commonDao.findByQuery(
"from PickTicket pt where pt.code=:code and CONVERT(varchar(10), pt.updateTime, 120)=:updateTime1",
new String[] { "code","updateTime1" }, new Object[] { code,updateTime1 });
if (pickTickets.size()>0) {
pickTicket=pickTickets.get(0);
}else {
pickTicket=new PickTicket();
}
pickTicket.setSourceType(sourceType);
pickTicket.setCode(code);
try {
pickTicket.setOrderDate(sdf.parse(orderDate1));
} catch (Exception e) {
e.printStackTrace();
}
for (BillType billType : billTypes) {
if (billType.equals(billTypeName)) {
pickTicket.setBillType(billType);
break;
}
}
if (status.equals("交单完成")) {
status="JIAODAN";
}else if (status.equals("未处理")){
status="OPEN";
}else if (status.equals("已完成")){
status="CLOSE";
}
pickTicket.setStatus(status);
pickTicket.setPackageQuantity(Double.valueOf(packageQuantity));
pickTicket.setBOLQuantity(Double.valueOf(BOLQuantity));
pickTicket.setOrderQuantity(Double.valueOf(orderQuantity));
pickTicket.setAllocatedQuantity(Double.valueOf(allocatedQuantity));
pickTicket.setPickedQuantity(Double.valueOf(pickedQuantity));
pickTicket.setShippedQuantity(Double.valueOf(shippedQuantity));
pickTicket.setRelatedBill3(relatedBill3);
pickTicket.setWorkerName1(workerName1);
pickTicket.setPrintCount(Integer.valueOf(printCount));
pickTicket.setPriority(Integer.valueOf(priority));
try {
pickTicket.setUpdateTime(sdfa.parse(updateTime1+" "+updateTime2));
} catch (Exception e) {
e.printStackTrace();
}
pickTicket.setRelatedBill1(relatedBill1);
pickTicket.setRelatedBill2(relatedBill2);
try {
pickTicket.setShipDate(sdfa.parse(shipDateStart1+" "+shipDateStart2));
} catch (Exception e) {
e.printStackTrace();
}
pickTicket.setLictrailer(lictrailer);
pickTicket.setLogisticsCompany(logisticsCompany);
pickTicket.setDriverName(driverName);
pickTicket.setUserName(userName);
commonDao.store(pickTicket);
}
} catch (BiffException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<editPage id="editImportPickTicketOrderPage" title="导入工单"
entityClass="com.dev.swms.server.model.shipping.PickTicket" width="270" height="130"
onClose="refreshParent">
<inputUIs>
<hidden id="pickTicket.id" reserve="false" />
<file id="imageFile" title="importFile" row="1" col="2"
readOnly="false" required="false" reserve="false" forceOverride="true"
inVisible="false" showImage="false" storeDir="IMAGE_FILE_DIR" />
</inputUIs>
<buttons>
<commit id="import" title="import" enableType="single"
invisible="false">
<mappings>
<mapping id="imageFile" className="file" />
</mappings>
<actions>
<action managerName="importFileManager" methodName="importPickTicketOrder"
parameter="imageFile" />
</actions>
<forwards>
<!-- <forward name="refreshParent" newEnabled="true" editEnabled="true"/> -->
<!-- <forward name="closeWindow" newEnabled="true" editEnabled="true"/> -->
<!-- <forward name="refreshWindow" newEnabled="true" editEnabled="true"/> -->
</forwards>
</commit>
</buttons>
</editPage>
</pages>

View File

@ -396,6 +396,9 @@
editEnabled="true" />
</forwards>
</commit>
<!-- 导入工单号 -->
<popup id="importPickTicketOrder" title="导入工单" enableType="none" invisible="false"
containId="true" pageId="editImportPickTicketOrderPage"/>
<popup id="viewException" title="查看异常"
enableType="single" invisible="false" containId="true" pageId="viewOutExceptionLogPage" />
</buttons>