|
@ -807,20 +807,6 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
|
|
|
order.setSellState("1");
|
|
|
orderDao.save(order);
|
|
|
}
|
|
|
sql = "SELECT\n" +
|
|
|
"\tcount(DISTINCT(id))\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_medicine_shipment_log\n" +
|
|
|
"WHERE\n" +
|
|
|
"\torder_id = '" + orderId + "'\n" +
|
|
|
"AND (`status` = 1\n" +
|
|
|
"OR `status` = 3)";
|
|
|
count = jdbcTemplate.queryForObject(sql, Integer.class);
|
|
|
if (count > 0) {
|
|
|
Mediicineorder order = orderDao.findOne(orderId);
|
|
|
order.setSellState("1");
|
|
|
orderDao.save(order);
|
|
|
}
|
|
|
|
|
|
//end
|
|
|
result.put("msg", ConstantUtils.SUCCESS);
|
|
@ -1387,52 +1373,52 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
|
|
|
if ("1".equals(map.get("orderStatus"))) {
|
|
|
map.put("orderStatusName", "药柜有药");
|
|
|
//生成出货单
|
|
|
|
|
|
int count = jdbcTemplate.queryForObject(
|
|
|
"SELECT\n" +
|
|
|
"\tcount(DISTINCT(id))\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_medicine_shipment_log\n" +
|
|
|
"WHERE\n" +
|
|
|
"\torder_id = '" + order.getId() + "'", Integer.class);
|
|
|
//已生成,查出来,放入,跳过后续生成代码
|
|
|
if (count > 0) {
|
|
|
String tempSql = "SELECT\n" +
|
|
|
"\tt.id AS id,\n" +
|
|
|
"\tt.device_id AS deviceId,\n" +
|
|
|
"\tt.order_id AS orderId,\n" +
|
|
|
"\tt.drug_id AS drugId,\n" +
|
|
|
"\tt.`status` AS `status`,\n" +
|
|
|
"\tt.out_time AS outTime,\n" +
|
|
|
"\tt.layer_no AS layerNo,\n" +
|
|
|
"\tt.wayer_no AS wayerNo,\n" +
|
|
|
"\tt.description AS description,\n" +
|
|
|
"\tt.create_time AS createTime,\n" +
|
|
|
"\tt.create_user AS createUser,\n" +
|
|
|
"\tt.create_user_name AS createUserName,\n" +
|
|
|
"\tt.update_time AS updateTime,\n" +
|
|
|
"\tt.update_user AS updateUser,\n" +
|
|
|
"\tt.update_user_name AS updateUserName,\n" +
|
|
|
"\tt.drug_bar_code AS drugBarCode,\n" +
|
|
|
"\tt.drug_code AS drugCode,\n" +
|
|
|
"\tt.drug_name AS drugName,\n" +
|
|
|
"\tt.pic AS pic,\n" +
|
|
|
"\tt.price AS price,\n" +
|
|
|
"\tt.specif AS specif,\n" +
|
|
|
"\tt.unit AS unit,\n" +
|
|
|
"\tt.org_code AS orgCode,\n" +
|
|
|
"\tt.org_name AS orgName,\n" +
|
|
|
" t.equ_name AS equName,\n" +
|
|
|
" t.dos_form AS dosForm\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_medicine_shipment_log AS t\n" +
|
|
|
"WHERE \n" +
|
|
|
"\tt.order_id = '" + order.getId() + "'";
|
|
|
List<Map<String, Object>> tempList = hibenateUtils.createSQLQuery(tempSql);
|
|
|
map.put("drugList", tempList);
|
|
|
orderList.add(map);
|
|
|
continue;
|
|
|
}
|
|
|
shipmentLogDao.deleteByOrderId(order.getId());
|
|
|
// int count = jdbcTemplate.queryForObject(
|
|
|
// "SELECT\n" +
|
|
|
// "\tcount(DISTINCT(id))\n" +
|
|
|
// "FROM\n" +
|
|
|
// "\tt_medicine_shipment_log\n" +
|
|
|
// "WHERE\n" +
|
|
|
// "\torder_id = '" + order.getId() + "'", Integer.class);
|
|
|
// //已生成,查出来,放入,跳过后续生成代码
|
|
|
// if (count > 0) {
|
|
|
// String tempSql = "SELECT\n" +
|
|
|
// "\tt.id AS id,\n" +
|
|
|
// "\tt.device_id AS deviceId,\n" +
|
|
|
// "\tt.order_id AS orderId,\n" +
|
|
|
// "\tt.drug_id AS drugId,\n" +
|
|
|
// "\tt.`status` AS `status`,\n" +
|
|
|
// "\tt.out_time AS outTime,\n" +
|
|
|
// "\tt.layer_no AS layerNo,\n" +
|
|
|
// "\tt.wayer_no AS wayerNo,\n" +
|
|
|
// "\tt.description AS description,\n" +
|
|
|
// "\tt.create_time AS createTime,\n" +
|
|
|
// "\tt.create_user AS createUser,\n" +
|
|
|
// "\tt.create_user_name AS createUserName,\n" +
|
|
|
// "\tt.update_time AS updateTime,\n" +
|
|
|
// "\tt.update_user AS updateUser,\n" +
|
|
|
// "\tt.update_user_name AS updateUserName,\n" +
|
|
|
// "\tt.drug_bar_code AS drugBarCode,\n" +
|
|
|
// "\tt.drug_code AS drugCode,\n" +
|
|
|
// "\tt.drug_name AS drugName,\n" +
|
|
|
// "\tt.pic AS pic,\n" +
|
|
|
// "\tt.price AS price,\n" +
|
|
|
// "\tt.specif AS specif,\n" +
|
|
|
// "\tt.unit AS unit,\n" +
|
|
|
// "\tt.org_code AS orgCode,\n" +
|
|
|
// "\tt.org_name AS orgName,\n" +
|
|
|
// " t.equ_name AS equName,\n" +
|
|
|
// " t.dos_form AS dosForm\n" +
|
|
|
// "FROM\n" +
|
|
|
// "\tt_medicine_shipment_log AS t\n" +
|
|
|
// "WHERE \n" +
|
|
|
// "\tt.order_id = '" + order.getId() + "'";
|
|
|
// List<Map<String, Object>> tempList = hibenateUtils.createSQLQuery(tempSql);
|
|
|
// map.put("drugList", tempList);
|
|
|
// orderList.add(map);
|
|
|
// continue;
|
|
|
// }
|
|
|
//未生成
|
|
|
List<MedicineShipmentLog> shipmentLogs = new ArrayList<>();
|
|
|
//订单详情遍历
|
|
@ -1460,35 +1446,76 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
|
|
|
"ORDER BY\n" +
|
|
|
"cast(t.layer_no AS UNSIGNED),cast(t.wayer_no AS UNSIGNED)"
|
|
|
);
|
|
|
// Mediicinedevice mediicinedevice = deviceDao.findMediicinedeviceByEquNum(deviceId);
|
|
|
for (int i = 0; i < qty; i++) {
|
|
|
for (Map<String, Object> objectMap : tempList) {
|
|
|
if (Integer.parseInt(String.valueOf(objectMap.get("qty"))) > 0) {
|
|
|
objectMap.put("qty", Integer.parseInt(String.valueOf(objectMap.get("qty"))) - 1);
|
|
|
MedicineShipmentLog shipmentLog = new MedicineShipmentLog();
|
|
|
shipmentLog.setDeviceId(deviceId);
|
|
|
shipmentLog.setOrderId(mediicineorderdetail.getIdOrder());
|
|
|
shipmentLog.setDrugId(mediicinedrugs.getId());
|
|
|
shipmentLog.setStatus("1");
|
|
|
shipmentLog.setLayerNo(objectMap.get("layerNo").toString());
|
|
|
shipmentLog.setWayerNo(objectMap.get("merge").toString());
|
|
|
shipmentLog.setDrugBarCode(mediicinedrugs.getDrugBarCode());
|
|
|
shipmentLog.setDrugCode(mediicinedrugs.getDrugCode());
|
|
|
shipmentLog.setDrugName(mediicinedrugs.getDrugName());
|
|
|
shipmentLog.setOrgCode(mediicinedrugs.getOrgCode());
|
|
|
shipmentLog.setOrgName(mediicinedrugs.getOrgName());
|
|
|
shipmentLog.setPic(mediicinedrugs.getPic());
|
|
|
shipmentLog.setPrice(mediicinedrugs.getPrice());
|
|
|
shipmentLog.setSpecif(mediicinedrugs.getSpecif());
|
|
|
shipmentLog.setUnit(mediicinedrugs.getUnit());
|
|
|
shipmentLog.setEquName(mediicinedevice.getEquName());
|
|
|
shipmentLog.setEquNum(mediicinedevice.getEquNum());
|
|
|
shipmentLog.setDosForm(mediicinedrugs.getDosForm());
|
|
|
shipmentLogDao.save(shipmentLog);
|
|
|
shipmentLogs.add(shipmentLog);
|
|
|
|
|
|
|
|
|
head:for (Map<String, Object> stringObjectMap : tempList) {
|
|
|
for (int j = 0; j < Integer.parseInt(stringObjectMap.get("qty").toString()); j++) {
|
|
|
if (qty == 0) {
|
|
|
break head;
|
|
|
}
|
|
|
qty--;
|
|
|
stringObjectMap.put("qty", Integer.parseInt(String.valueOf(stringObjectMap.get("qty"))) - 1);
|
|
|
MedicineShipmentLog shipmentLog = new MedicineShipmentLog();
|
|
|
shipmentLog.setDeviceId(deviceId);
|
|
|
shipmentLog.setOrderId(mediicineorderdetail.getIdOrder());
|
|
|
shipmentLog.setDrugId(mediicinedrugs.getId());
|
|
|
shipmentLog.setStatus("1");
|
|
|
shipmentLog.setLayerNo(stringObjectMap.get("layerNo").toString());
|
|
|
shipmentLog.setWayerNo(stringObjectMap.get("merge").toString());
|
|
|
shipmentLog.setDrugBarCode(mediicinedrugs.getDrugBarCode());
|
|
|
shipmentLog.setDrugCode(mediicinedrugs.getDrugCode());
|
|
|
shipmentLog.setDrugName(mediicinedrugs.getDrugName());
|
|
|
shipmentLog.setOrgCode(mediicinedrugs.getOrgCode());
|
|
|
shipmentLog.setOrgName(mediicinedrugs.getOrgName());
|
|
|
shipmentLog.setPic(mediicinedrugs.getPic());
|
|
|
shipmentLog.setPrice(mediicinedrugs.getPrice());
|
|
|
shipmentLog.setSpecif(mediicinedrugs.getSpecif());
|
|
|
shipmentLog.setUnit(mediicinedrugs.getUnit());
|
|
|
shipmentLog.setEquName(mediicinedevice.getEquName());
|
|
|
shipmentLog.setEquNum(mediicinedevice.getEquNum());
|
|
|
shipmentLog.setDosForm(mediicinedrugs.getDosForm());
|
|
|
shipmentLogDao.save(shipmentLog);
|
|
|
shipmentLogs.add(shipmentLog);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// //药品数目
|
|
|
// for (int i = 0; i < qty; i++) {
|
|
|
//
|
|
|
// for (Map<String, Object> stringObjectMap : tempList) {
|
|
|
// for (int j = 0; a < Integer.parseInt(stringObjectMap.get("qty").toString()); j++) {
|
|
|
// if (Integer.parseInt(String.valueOf(stringObjectMap.get("qty"))) == 0) {
|
|
|
// break;
|
|
|
// }
|
|
|
// stringObjectMap.put("qty", Integer.parseInt(String.valueOf(stringObjectMap.get("qty"))) - 1);
|
|
|
// MedicineShipmentLog shipmentLog = new MedicineShipmentLog();
|
|
|
// shipmentLog.setDeviceId(deviceId);
|
|
|
// shipmentLog.setOrderId(mediicineorderdetail.getIdOrder());
|
|
|
// shipmentLog.setDrugId(mediicinedrugs.getId());
|
|
|
// shipmentLog.setStatus("1");
|
|
|
// shipmentLog.setLayerNo(stringObjectMap.get("layerNo").toString());
|
|
|
// shipmentLog.setWayerNo(stringObjectMap.get("merge").toString());
|
|
|
// shipmentLog.setDrugBarCode(mediicinedrugs.getDrugBarCode());
|
|
|
// shipmentLog.setDrugCode(mediicinedrugs.getDrugCode());
|
|
|
// shipmentLog.setDrugName(mediicinedrugs.getDrugName());
|
|
|
// shipmentLog.setOrgCode(mediicinedrugs.getOrgCode());
|
|
|
// shipmentLog.setOrgName(mediicinedrugs.getOrgName());
|
|
|
// shipmentLog.setPic(mediicinedrugs.getPic());
|
|
|
// shipmentLog.setPrice(mediicinedrugs.getPrice());
|
|
|
// shipmentLog.setSpecif(mediicinedrugs.getSpecif());
|
|
|
// shipmentLog.setUnit(mediicinedrugs.getUnit());
|
|
|
// shipmentLog.setEquName(mediicinedevice.getEquName());
|
|
|
// shipmentLog.setEquNum(mediicinedevice.getEquNum());
|
|
|
// shipmentLog.setDosForm(mediicinedrugs.getDosForm());
|
|
|
// shipmentLogDao.save(shipmentLog);
|
|
|
// shipmentLogs.add(shipmentLog);
|
|
|
// }
|
|
|
//
|
|
|
// }
|
|
|
//
|
|
|
// }
|
|
|
|
|
|
|
|
|
}
|
|
|
map.put("drugList", shipmentLogs);
|
|
|
|