huxy il y a 2 ans
Parent
commit
1b882e6d21

+ 15 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListItemMapper.xml

@@ -27,18 +27,19 @@
 			end_case_number,
 			colour,
 			pieces_box,
-			box_number,
+			sum(box_number) boxnumber,/*箱数*/
 			sum(total) total,/*件数*/
 			net_weight,
-			total_net_weight total_net_weight,/*总净重*/
+			sum(total_net_weight) total_net_weight,/*总净重*/
 			gross_weight,
-			total_gross_weight total_gross_weight,/*总毛重*/
-			outer_box_length,
-			outer_Box_Width,
-			total_volume total_volume,/*总体积*/
+			sum(total_gross_weight) total_gross_weight,/*总毛重*/
+			outer_box_length,/*长*/
+			outer_Box_Width,/*宽*/
+			outer_Box_Height,/*高*/
+			sum(total_volume) total_volume,/*总体积*/
 			net_weight_too net_weight_too,/*净净重*/
 			unit_price,
-			total_price total_price,/*总价*/
+			sum(total_price) total_price,/*总价*/
 			with_code,
 			small_po,
 			inventory_name,
@@ -73,7 +74,7 @@
            	sy_shipping_details_item.distribution_Point distributionPoint, /*分销点 s*/
             sy_shipping_details_item.inventory_Name inventoryName, /*存货名称 s*/
             sum(sy_shipping_details_item.shipment_Quantity) total,/*数量 s*/
-            SUM(sy_shipping_details_item.shipment_Quantity)/sy_order_data_item.box_Number piecesBox,
+            SUM(sy_shipping_details_item.shipment_Quantity)/sy_order_data_item.box_Number piecesBox,/*每箱件数*/
             sy_order_data_item.box_Number boxNumber,/*箱数*/
             sy_shipping_details_item.pur_Or_Sub_Order  purOrSubOrder /*采购/委外订单号 s*/
 		 FROM sy_shipping_details
@@ -127,7 +128,12 @@
 
 	<!--预装箱单获取id的所有尺码并排序-->
 	<select id="querySize2" resultType="org.jeecg.modules.spapl.entity.SizeTable" >
-		SELECT sy_pre_assembled_packing_list_item.size,alias,total quantity,box_Number,total/box_Number proportion,
+		SELECT sy_pre_assembled_packing_list_item.size,
+		alias,
+		total quantity,
+		box_Number,
+		total/(SELECT SUM(box_number) FROM sy_pre_assembled_packing_list_item WHERE
+		 sy_pre_assembled_packing_list_id=#{value2}) proportion,
 		sy_pre_assembled_packing_list_item.id itemId
 			FROM sy_pre_assembled_packing_list_item
 			LEFT JOIN sizetable ON sy_pre_assembled_packing_list_item.`size`=sizetable.`size`

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListMapper.xml

@@ -36,7 +36,7 @@
 			a.pre_delivery_date,/*预发货日期*/
 			a.order_type,/*订单类型*/
 			b.customer_abbreviation,/*客户简称*/
-			b.masterMetering,/*计量单位*/
+			b.master_Metering,/*计量单位*/
 			SUM(b.total) total,/*件数*/
 			sum(b.box_Number) totalboxes,/*总箱数*/
 			sum(b.total_net_weight) totalnetweight,/*总净重*/

+ 13 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/service/impl/SyPreAssembledPackingListServiceImpl.java

@@ -53,8 +53,8 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 			for (SizeTable size : sizes){
 				SyPreAssembledPackingListItem item1=item;
 				BigDecimal boxNumber=boxNumber1.multiply(new BigDecimal(size.getProportion()));//获取该尺码箱数
-				item1.setTotal(boxNumber.multiply(item1.getPiecesBox()));//获取该尺码件数
-				item1.setBoxNumber(boxNumber);
+				item1.setTotal(boxNumber.multiply(item1.getPiecesBox()));//该尺码件数
+				item1.setBoxNumber(boxNumber);//获取箱数
 				item1.setTotalNetWeight(boxNumber.multiply(item1.getNetWeight()));//获取总净重		净重*箱数
 				item1.setTotalGrossWeight(boxNumber.multiply(item1.getGrossWeight()));//获取总毛重 	箱数*毛重/箱
 				//item1.setTotalNetWeight(boxNumber.multiply(new BigDecimal(size.getProportion())));//获取净净重 不知
@@ -62,7 +62,8 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 				volume=volume.multiply(item1.getOuterBoxLength());
 				volume=volume.multiply(item1.getOuterBoxWidth());
 				item1.setTotalVolume(volume);//获取总体积							长*宽*高*箱数
-				item1.setTotalPrice(boxNumber.multiply(item1.getUnitPrice()));//获取总价		箱数*单价
+				boxNumber=boxNumber.multiply(item1.getPiecesBox());//获取该尺码件数
+				item1.setTotalPrice(boxNumber.multiply(item1.getUnitPrice()));//获取总价		箱数*单价-->件数*单价
 				item1.setSize(size.getSize());//获取尺码
 				item1.setSyDeclarationElementsItemId(size.getItemId());//获取到发运明细子表id
 				item1.setSort(size.getNum());//获取序号
@@ -76,13 +77,14 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 	List<SyPreAssembledPackingListItem> update(List<SyPreAssembledPackingListItem> items,String pid){
 		for (SyPreAssembledPackingListItem item : items){
 			List<SizeTable> sizes=item.getSizeTables();//获取尺码表信息
-			BigDecimal boxNumber1=item.getBoxNumber().divide(item.getPiecesBox(),2,BigDecimal.ROUND_HALF_UP);//获取箱数
+			BigDecimal boxNumber1=item.getBoxNumber().divide(item.getPiecesBox(),2,BigDecimal.ROUND_HALF_UP);//获取箱数比例
 			item.setDelFlag("0");
 			for (SizeTable size : sizes){
 				SyPreAssembledPackingListItem item1=item;
 				BigDecimal boxNumber=boxNumber1.multiply(new BigDecimal(size.getProportion()));//获取该尺码箱数
 				item1.setSize(size.getSize());//获取尺码信息
-				item1.setTotal(boxNumber.multiply(new BigDecimal(size.getProportion())));//该尺码件数
+				item1.setTotal(boxNumber.multiply(item1.getPiecesBox()));//该尺码件数
+				item1.setBoxNumber(boxNumber);//获取箱数
 				item1.setTotalNetWeight(boxNumber.multiply(item1.getNetWeight()));//获取总净重		净重*箱数
 				item1.setTotalGrossWeight(boxNumber.multiply(item1.getGrossWeight()));//获取总毛重 	箱数*毛重/箱
 				//item1.setTotalNetWeight(boxNumber.multiply(new BigDecimal(size.getProportion())));//获取净净重 不知
@@ -90,7 +92,8 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 				volume=volume.multiply(item1.getOuterBoxLength());
 				volume=volume.multiply(item1.getOuterBoxWidth());
 				item1.setTotalVolume(volume);//获取总体积							长*宽*高*箱数
-				item1.setTotalPrice(boxNumber.multiply(item1.getUnitPrice()));//获取总价		箱数*单价
+				boxNumber=boxNumber.multiply(item1.getPiecesBox());//获取该尺码件数
+				item1.setTotalPrice(boxNumber.multiply(item1.getUnitPrice()));//获取总价		箱数*单价-->件数*单价
 				//item.setSyDeclarationElementsItemId(size.getItemId());//获取到发运明细子表id
 				item1.setId(size.getItemId());//从尺码表中获取到id
 				// 获取到发运明细子表id
@@ -117,9 +120,12 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 	public SyPreAssembledPackingList saveMain2(SyPreAssembledPackingList syPreAssembledPackingList) {
 		List<SyPreAssembledPackingListItem> items=syPreAssembledPackingList.getSyPreAssembledPackingListItemList();
 		syPreAssembledPackingList.setDocumentNo(oConvertUtils.id());//随机单据号
+		if(oConvertUtils.isEmpty(syPreAssembledPackingList.getOrderNumber())){
+			syPreAssembledPackingList.setOrderNumber(oConvertUtils.id());//随机订单号
+		}
 		syPreAssembledPackingList.setDelFlag("0");//删除状态默认为0
 		syPreAssembledPackingList.setPushStatus("0");//推送状态默认为0
-		syPreAssembledPackingList.setStatus("0");//单据装填默认为0
+		syPreAssembledPackingList.setStatus("0");//单据状态默认为0
 		syPreAssembledPackingListMapper.insert(syPreAssembledPackingList);//往主表添加数据
 		if(syPreAssembledPackingList.getSyPreAssembledPackingListItemList()!=null){
 			add(syPreAssembledPackingList.getSyPreAssembledPackingListItemList(),syPreAssembledPackingList.getId());