定时同步发货单调整
This commit is contained in:
		
							parent
							
								
									bdfad6b0f3
								
							
						
					
					
						commit
						ac6b321f6d
					
				|  | @ -10,10 +10,8 @@ import com.yb.lb.common.config.UserConfig; | |||
| import com.yb.lb.common.utils.*; | ||||
| import com.yb.lb.webapp.Invoice.entity.InvoiceDetail; | ||||
| import com.yb.lb.webapp.Invoice.entity.InvoiceInfo; | ||||
| import com.yb.lb.webapp.goodsinfo.goods.entity.GoodsInfo; | ||||
| import com.yb.lb.webapp.random.service.RandomService; | ||||
| import com.yb.lb.webapp.redis.service.RedisService; | ||||
| import com.yb.lb.webapp.u8.ueight.entity.CustomerInfo; | ||||
| import com.yb.lb.webapp.u8.ueight.service.OrderUeightService; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | @ -22,7 +20,6 @@ import org.springframework.stereotype.Service; | |||
| 
 | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.File; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | @ -49,84 +46,6 @@ public class CrmInvoiceService { | |||
|     @Autowired | ||||
|     BaseSqlServer2Dao<InvoiceInfo> dao2; | ||||
| 
 | ||||
|     /** | ||||
|      * 新增 | ||||
|      * | ||||
|      * @author lyb | ||||
|      * @date 20210526 | ||||
|      */ | ||||
|     public boolean addInfo(Map<String, String> params, String id, String json) { | ||||
|         String companyId = params.get("companyId") + ""; | ||||
|         String invoiceNo = randomService.randomUtils2(FINALCMD.INVOICE_NO, DateUtil.getDays(), companyId); | ||||
|         params.put("invoiceNo", invoiceNo); | ||||
|         if (dao.counts(InvoiceInfo.class.getName() + ".findCode", params) > 0) { | ||||
|             invoiceNo = randomService.randomUtils2(FINALCMD.INVOICE_NO, DateUtil.getDays(), companyId); | ||||
|             params.put("invoiceNo", invoiceNo); | ||||
|         } | ||||
|         //添加主表 | ||||
|         if (dao.add_obj(InvoiceInfo.class.getName() + id, params)) { | ||||
|             List lists = new ArrayList(); | ||||
|             List goodsList = new ArrayList(); | ||||
|             List<Map<String, Object>> list = ListOrMapForJson.getlistForJson(json); | ||||
|             for (Map map : list) { | ||||
|                 map.put("invoiceId", params.get("id") + ""); | ||||
|                 map.put("id", IdUtil.simpleUUID()); | ||||
|                 map.put("createTime", DateUtil.getTime()); | ||||
|                 lists.add(map); | ||||
|                 // 引用 | ||||
|                 Map tMap = new HashMap(); | ||||
|                 tMap.put("id", IdUtil.simpleUUID()); | ||||
|                 tMap.put("archivesId", params.get("id") + ""); | ||||
|                 tMap.put("quoteId", map.get("goodsId") + ""); | ||||
|                 goodsList.add(tMap); | ||||
|             } | ||||
|             if (dao.add_obj(InvoiceDetail.class.getName() + ".addCrmInvoiceDetails", lists)) { | ||||
|                 // 添加对商品的引用 | ||||
|                 dao.add_obj(GoodsInfo.class.getName() + ".addQuotes", goodsList); | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 发货单修改 | ||||
|      * | ||||
|      * @author lyb | ||||
|      * @date 20210526 | ||||
|      */ | ||||
|     public boolean updateInfo(Map<String, String> params, String id, String json) { | ||||
|         if (dao.update(InvoiceInfo.class.getName() + id, params)) { | ||||
|             Map<String, Object> info = new HashMap<>(); | ||||
|             String invoiceId = params.get("id") + ""; | ||||
|             info.put("invoiceId", invoiceId); | ||||
|             dao.delete(InvoiceDetail.class.getName() + ".deleteCrmInvoiceDetailById", info); | ||||
|             List lists = new ArrayList(); | ||||
|             List goodsList = new ArrayList(); | ||||
|             List<Map<String, Object>> list = ListOrMapForJson.getlistForJson(json); | ||||
|             for (Map map : list) { | ||||
|                 map.put("invoiceId", invoiceId); | ||||
|                 map.put("id", IdUtil.simpleUUID()); | ||||
|                 map.put("createTime", DateUtil.getTime()); | ||||
|                 lists.add(map); | ||||
|                 // 引用 | ||||
|                 Map tMap = new HashMap(); | ||||
|                 tMap.put("id", IdUtil.simpleUUID()); | ||||
|                 tMap.put("archivesId", invoiceId); | ||||
|                 tMap.put("quoteId", map.get("goodsId") + ""); | ||||
|                 goodsList.add(tMap); | ||||
|             } | ||||
|             if (dao.add_obj(InvoiceDetail.class.getName() + ".addCrmInvoiceDetails", lists)) { | ||||
|                 // 删除商品的引用 | ||||
|                 dao.delete(GoodsInfo.class.getName() + ".deleteQuoteById", invoiceId); | ||||
|                 // 添加对商品的引用 | ||||
|                 dao.add_obj(GoodsInfo.class.getName() + ".addQuotes", goodsList); | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 通用修改 | ||||
|      * | ||||
|  |  | |||
|  | @ -97,6 +97,8 @@ public class OrderCronService { | |||
|                             goodsMap1.put("createTime", createTime); | ||||
|                         } | ||||
|                         if (orderUeightService.addOrderDetail(goodsList1)) { | ||||
|                             // 因为U8的id是存到100和4002个数据库中的,可能会重复,因此视图中加了字符便于区分,所以这里需要获取U8的原始id回写U8 | ||||
|                             info.put("id", getBeforeDash(orderId)); | ||||
|                             // 回写U8销售出库单的状态 | ||||
|                             if (FINALCMD.KESAI.equals(companyId)) { | ||||
|                                 orderUeightService.update(".updateOrderInfo", info); | ||||
|  | @ -137,4 +139,11 @@ public class OrderCronService { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public String getBeforeDash(String input) { | ||||
|         if (input == null || !input.contains("-")) { | ||||
|             return input; | ||||
|         } | ||||
|         return input.split("-")[0]; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue