ccjgmwz 4 anni fa
parent
commit
191b6e3624

+ 1 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/collect/CollectServiceImpl.java

@@ -281,6 +281,7 @@ public class CollectServiceImpl implements CollectService {
             taskDO.setTaskStatus(TaskStatusType.STATUS1.getCode());
             taskDO.setCarNo(tmp.getCarNo());
             taskDO.setBoxNo(tmp.getBoxNo());
+            taskDO.setTitleNo(tmp.getTitleNo());
             taskDO.setGmtCreate(now);
             taskDO.setGmtUpdate(now);
             taskDO.setCompanyId(companyId);

+ 5 - 0
unimall-admin/src/views/collect/collect.vue

@@ -250,6 +250,11 @@
               <el-input v-model="scope.row.boxNo" :readonly="scope.row.id == undefined ? false : true "/>
             </template>
           </el-table-column>
+          <el-table-column align="center" label="封号" prop="boxNo">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.titleNo" :readonly="scope.row.id == undefined ? false : true "/>
+            </template>
+          </el-table-column>
         </el-table>
       </el-form>
       <div slot="footer" class="dialog-footer">

+ 122 - 12
unimall-app-api/src/main/java/com/iotechn/unimall/app/api/trade/TradeAppServiceImpl.java

@@ -8,6 +8,7 @@ import com.iotechn.unimall.core.exception.AdminServiceException;
 import com.iotechn.unimall.core.exception.AppServiceException;
 import com.iotechn.unimall.core.exception.ExceptionDefinition;
 import com.iotechn.unimall.core.exception.ServiceException;
+import com.iotechn.unimall.core.util.CalculationUtil;
 import com.iotechn.unimall.core.util.GeneratorUtil;
 import com.iotechn.unimall.data.domain.*;
 import com.iotechn.unimall.data.dto.DynamicDTO;
@@ -64,6 +65,8 @@ public class TradeAppServiceImpl implements TradeAppService {
     private GeTuiUtils geTuiUtils;
     @Autowired
     private PositionReportMapper positionReportMapper;
+    @Autowired
+    BuyReportMapper buyReportMapper;
 
     WebSocket webSocket = new WebSocket();
 
@@ -312,6 +315,7 @@ public class TradeAppServiceImpl implements TradeAppService {
 
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void confirm(String id) throws ServiceException, ParseException {
         TradeContractDO tradeContractDO = tradeContractMapper.selectById(id);
         Wrapper wrapper = new EntityWrapper();
@@ -324,22 +328,128 @@ public class TradeAppServiceImpl implements TradeAppService {
             wrapper.eq("task_status", TaskStatusType.STATUS4.getCode());
             wrapper.eq("order_no", tradeDO.getOrderNo());
             List<TaskDO> taskDOS = taskMapper.selectList(wrapper);
+            Date now = new Date();
             if (taskDOS.size() > 0) {
                 TaskDO taskDO = taskDOS.get(0);
                 taskDO.setIsConfirm(0);
-                taskDO.setTaskStatus(TaskStatusType.STATUS1.getCode());
+                taskDO.setTaskStatus(TaskStatusType.STATUS2.getCode());
                 taskMapper.updateById(taskDO);
-
-                Map<String, Object> map = new HashMap<>();
-                map.put("value", taskDO.getCarNo());
-                map.put("valueOne", storeMapper.selectById(taskDO.getStoreId()).getName());
-                map.put("page", "pages/user/task");
-                map.put("templateId", "T6EwpfrZ9KkKjriCZVRqOYIJjQFYkoWwAGSalX9Ky_c");
-                map.put("userId", taskDO.getUserId());
-                map.put("header", "您好,客户已确定可完成入库任务!");
-                map.put("remark", "点击进入小程序完成任务");
-                sendUtils.sendMessageForDeliver(map);
-                geTuiUtils.pushByCid("客户确认提醒","客户已确认可以卸货,请及时完成入库任务",taskDO.getUserId());
+                BuyDO buyDO = buyMapper.selectById(tradeDO.getSalebuyId());
+                if (buyDO != null) {
+                    StoreDO storeDO = storeMapper.selectById(buyDO.getStoreId());
+                    storeDO.setInventory(storeDO.getInventory()+taskDO.getNetWeight());
+                    storeMapper.updateById(storeDO);
+                }
+                // 查询公司负责人姓名
+                CompanyDO companyDO = companyMapper.selectById(tradeDO.getTradeCompanyId());
+                BuyReportDO buyReportDO = reportMapper.getTradeBuyContract(taskDO.getId());
+                buyReportDO.setSellerName(companyDO.getPersonName());
+                buyReportDO.setGmtUpdate(now);
+                buyReportDO.setGmtCreate(now);
+                buyReportDO.setUserId(taskDO.getUserId());
+                if(buyReportDO.getCount() <0){
+                    BuyReportDO buyReportDOTurn = new BuyReportDO();
+                    buyReportDO.setCompanyId(tradeDO.getCompanyId());
+                    BeanUtils.copyProperties(buyReportDO,buyReportDOTurn);
+                    buyReportDOTurn.setCount(0f);
+                    buyReportDOTurn.setGmtCreate(now);
+                    buyReportDOTurn.setGmtUpdate(now);
+                    buyReportDOTurn.setReplen(CalculationUtil.subToFloat(0,buyReportDO.getCount()));
+                    buyReportDOTurn.setNetWeight(CalculationUtil.subToFloat(0,buyReportDO.getCount()));
+
+                    //已结束计算仓储费情况
+                    if(buyReportDO.getStorageFee() > 0){
+                        buyReportDOTurn.setStorageFee(CalculationUtil.mulToFloat(CalculationUtil.div(buyReportDO.getStorageFee(),buyReportDO.getNetWeight()),buyReportDOTurn.getNetWeight()));
+                        buyReportDO.setStorageFee(buyReportDO.getStorageFee() - buyReportDOTurn.getStorageFee());
+                        buyReportDO.setNetWeight(CalculationUtil.addToFloat(buyReportDO.getNetWeight(),buyReportDO.getCount()));
+                        buyReportDO.setMoney(CalculationUtil.mulToFloat(CalculationUtil.div(buyReportDO.getMoney(),buyReportDO.getNetWeight()),CalculationUtil.addToFloat(buyReportDO.getNetWeight(),buyReportDO.getCount())));
+                        buyReportDO.setNotMoney(CalculationUtil.mulToFloat(CalculationUtil.div(buyReportDO.getNotMoney(),buyReportDO.getNetWeight()),CalculationUtil.addToFloat(buyReportDO.getNetWeight(),buyReportDO.getCount())));
+                        buyReportDOTurn.setCount(0f);
+                        buyReportDOTurn.setGmtCreate(now);
+                        buyReportDOTurn.setGmtUpdate(now);
+                        buyReportDOTurn.setReplen(CalculationUtil.subToFloat(0,buyReportDO.getCount()));
+                        buyReportDOTurn.setNetWeight(CalculationUtil.subToFloat(0,buyReportDO.getCount()));
+                        buyReportDOTurn.setUnitPrice1(0f);
+                        buyReportDOTurn.setMoney(0f);
+                        buyReportDOTurn.setNotMoney(0f);
+                        buyReportDO.setCount(0f);
+                        buyReportMapper.insert(buyReportDO);
+                        buyReportMapper.insert(buyReportDOTurn);
+                    }
+                    //未结束计算仓储费情况
+                    else{
+                        wrapper = new EntityWrapper();
+                        wrapper.eq("order_no",tradeDO.getOrderNo());
+                        wrapper.eq("task_status",TaskStatusType.STATUS2.getCode());
+                        wrapper.eq("task_type","入库任务");
+                        wrapper.eq("car_no",buyReportDO.getCarNo());
+                        taskDOS = taskMapper.selectList(wrapper);
+                        if(taskDOS.size() > 0){
+                            taskDO = taskDOS.get(0);
+                            TaskDO taskTurn = new TaskDO();
+                            BeanUtils.copyProperties(taskDO,taskTurn);
+                            taskDO.setNetWeight(CalculationUtil.addToFloat(taskDO.getNetWeight(),buyReportDO.getCount()));
+                            taskDO.setGrossWeight(CalculationUtil.addToFloat(taskDO.getNetWeight(),taskDO.getSkinWeight()));
+                            taskTurn.setNetWeight(buyReportDOTurn.getNetWeight());
+                            taskTurn.setGrossWeight(CalculationUtil.addToFloat(taskTurn.getNetWeight(),taskTurn.getSkinWeight()));
+                            taskTurn.setGmtUpdate(now);
+                            buyReportDO.setNetWeight(CalculationUtil.addToFloat(buyReportDO.getNetWeight(),buyReportDO.getCount()));
+//                                buyReportDO.setMoney(CalculationUtil.mulToFloat(CalculationUtil.div(buyReportDO.getMoney(),buyReportDO.getNetWeight()),CalculationUtil.addToFloat(buyReportDO.getNetWeight(),buyReportDO.getCount())));
+//                                buyReportDO.setNotMoney(CalculationUtil.mulToFloat(CalculationUtil.div(buyReportDO.getNotMoney(),buyReportDO.getNetWeight()),CalculationUtil.addToFloat(buyReportDO.getNetWeight(),buyReportDO.getCount())));
+                            buyReportDO.setMoney(CalculationUtil.mulToFloat(buyReportDO.getNetWeight(),buyReportDO.getUnitPrice1()));
+                            buyReportDO.setNotMoney(CalculationUtil.mulToFloat(buyReportDO.getNetWeight(),buyReportDO.getUnitPrice1()));
+                            buyReportDOTurn.setCount(0f);
+                            buyReportDOTurn.setGmtCreate(now);
+                            buyReportDOTurn.setGmtUpdate(now);
+                            buyReportDOTurn.setReplen(CalculationUtil.subToFloat(0,buyReportDO.getCount()));
+                            buyReportDOTurn.setNetWeight(CalculationUtil.subToFloat(0,buyReportDO.getCount()));
+                            buyReportDOTurn.setUnitPrice1(0f);
+                            buyReportDOTurn.setMoney(0f);
+                            buyReportDOTurn.setNotMoney(0f);
+                            buyReportDO.setCount(0f);
+                            buyReportMapper.insert(buyReportDO);
+                            buyReportMapper.insert(buyReportDOTurn);
+                            taskDO.setReportId(buyReportDO.getId());
+                            taskTurn.setReportId(buyReportDOTurn.getId());
+                            taskMapper.updateById(taskDO);
+                            taskMapper.insert(taskTurn);
+                        }
+                        else{
+                            throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION);
+                        }
+                    }
+                }
+                else{
+                    buyReportDO.setGmtCreate(now);
+                    buyReportDO.setGmtUpdate(now);
+                    buyReportDO.setUserId(taskDO.getUserId());
+                    buyReportDO.setCompanyId(taskDO.getCompanyId());
+                    if(buyReportMapper.insert(buyReportDO) <= 0){
+                        throw new AppServiceException(ExceptionDefinition.APP_UNKNOWN_EXCEPTION);
+                    }
+                    taskDO.setReportId(buyReportDO.getId());
+                    taskMapper.updateById(taskDO);
+                }
+                MessageDO messageDO = new MessageDO();
+                messageDO.setCustomer("客户");
+                messageDO.setOperation(" 已确认"+buyReportDO.getCarNo()+"车辆卸货,");
+                messageDO.setResult("请及时申请付款");
+                messageDO.setGmtUpdate(now);
+                messageDO.setGmtCreate(now);
+                messageDO.setCompanyId(buyReportDO.getCompanyId());
+                messageDO.setPath("/report/tradeTotal");
+                messageMapper.insert(messageDO);
+                webSocket.sendMessageByRole(messageDO, "内勤", buyReportDO.getCompanyId());
+//                Map<String, Object> map = new HashMap<>();
+//                map.put("value", taskDO.getCarNo());
+//                map.put("valueOne", storeMapper.selectById(taskDO.getStoreId()).getName());
+//                map.put("page", "pages/user/task");
+//                map.put("templateId", "T6EwpfrZ9KkKjriCZVRqOYIJjQFYkoWwAGSalX9Ky_c");
+//                map.put("userId", taskDO.getUserId());
+//                map.put("header", "您好,客户已确定可完成入库任务!");
+//                map.put("remark", "点击进入小程序完成任务");
+//                sendUtils.sendMessageForDeliver(map);
+//                geTuiUtils.pushByCid("客户确认提醒","客户已确认可以卸货,请及时完成入库任务",taskDO.getUserId());
             }
 
         }

+ 6 - 0
unimall-app-api/src/main/java/com/iotechn/unimall/app/api/tran/TranAppServiceImpl.java

@@ -419,6 +419,12 @@ public class TranAppServiceImpl implements TranAppService{
                     taskDO.setWarehouse(warehouse);
                     taskDO.setWaterContent(waterContent);
                     taskDO.setRemarks(remarks);
+                    taskDO.setUserId(userId);
+                    taskDO.setGrossWeight(grossWeight);
+                    taskDO.setSkinWeight(skinWeight);
+                    taskDO.setNetWeight(netWeight);
+                    taskDO.setPoundImg(poundImg);
+                    taskDO.setDeduction(deduction);
                     taskMapper.updateById(taskDO);
                     // 取得客户ID
                     wrapper1 = new EntityWrapper<>();

+ 1 - 1
unimall-app-api/src/main/java/com/iotechn/unimall/app/api/user/UserService.java

@@ -111,7 +111,7 @@ public interface UserService {
             @HttpParam(name = "role", type = HttpParamType.COMMON, description = "角色") String role,
             @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;
     @HttpMethod(description = "测试接口")
-    void test() throws ServiceException;
+    String test() throws ServiceException;
     @HttpMethod(description = "生成二维码")
     String getQrCode(
             @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

+ 8 - 1
unimall-app-api/src/main/java/com/iotechn/unimall/app/api/user/UserServiceImpl.java

@@ -937,7 +937,14 @@ public class UserServiceImpl implements UserService {
     }
 
     @Override
-    public void test() throws ServiceException {
+    public String test() throws ServiceException {
+        UserDO userDO = userMapper.selectById(21);
+        if(userDO.getGender() == 1){
+            return null;
+        }
+        else{
+            return "ok";
+        }
     }
 
     @Override

+ 2 - 2
unimall-app/pageA/pages/deliver_goods.vue

@@ -59,7 +59,7 @@
 			boxshadow="0 0 6rpx rgba(36, 90, 141, 0.5)"
 			@btnClick="deliver"
 			/>
-			<block v-if="tradeStatus!='3' && tradeStatus!='4'">
+			<!-- <block v-if="tradeStatus!='3' && tradeStatus!='4'">
 			<drag-button
 				:isDock="true"
 				:existTabBar="true"
@@ -69,7 +69,7 @@
 				boxshadow='0 0 6rpx rgba(36, 90, 141, 0.5)'
 				@btnClick="price"
 			/>
-			</block>
+			</block> -->
 		
 		<!-- <view v-show='showPopup' class="popupItem">
 			<view class='wrap'>

+ 6 - 6
unimall-app/pageA/pages/task_detail_ck.vue

@@ -25,6 +25,12 @@
 						<text>{{boxNo}}</text>
 					</view>
 				</view>
+				<view class="c-row b-b">
+					<text class="tit">封号</text>
+					<view class="con-list">
+						<text>{{titleNo}}</text>
+					</view>
+				</view>
 		<!-- 		<view class="c-row b-b">
 					<text class="tit">目的地</text>
 					<view class="con-list">
@@ -94,12 +100,6 @@
 						<input placeholder="请填写件数" name="input" v-model="memo" ></input>
 					</view>
 				</view>
-				<view class="c-row b-b">
-					<text class="tit">封号</text>
-					<view class="con-list">
-						<input placeholder="请填写封号" name="input" v-model="titleNo" ></input>
-					</view>
-				</view>
 				<view class="cu-form-group margin-top">
 					<view class="title">出库方式</view>
 					<picker @change="OutModeChange" :value="outModeeIndex" :range="outMode">

+ 17 - 3
unimall-app/pages/home/home.vue

@@ -59,7 +59,7 @@
 			</view>
 			</u-navbar>
 			<!-- #endif -->
-			<u-cell-group>
+			<u-cell-group v-if="isShowFlag">
 				<u-cell-item  title="粮友圈" :title-style="{marginLeft:'30rpx',fontWeight:'800'}" @tap="linkToMoment">
 					<u-icon slot="icon" name="moments" color="#409eff" size="40"></u-icon> 
 				</u-cell-item>
@@ -204,7 +204,8 @@ export default {
 				}
 			],
 			$url:'',
-			userInfo:[]
+			userInfo:[],
+			isShowFlag:false
 		}
 	},
 	watch:{
@@ -297,7 +298,19 @@ export default {
 			}else if(this.PageCur=='contract'){
 			 	this.getFriends(false)
 			}else if(this.PageCur=='find'){
-				this.querylinkItem(false)
+				const that = this
+				that.$api.request('user', 'test', failres => {
+					that.$api.msg(failres.errmsg)
+					uni.hideLoading()
+				}).then(res => {
+					console.log("res === ",res)
+					if(res.data){
+						that.isShowFlag = true
+					}
+					this.querylinkItem(false)
+					uni.hideLoading()
+				})
+				
 			}
 		},
 		linkTochat(item){
@@ -444,6 +457,7 @@ export default {
 			});
 		},
 		linkToMoment(){
+			
 			this.$u.route({
 				url:'pageC/firendCircle/firendCircle'
 			})

+ 27 - 16
unimall-app/pages/user/task.vue

@@ -9,22 +9,33 @@
 				 @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index"
 			>
 			<view class='wrap' >
-				<view  style='align-items: center;' class="flex justify-between padding-xs">
+				<view  style='align-items: center;' class="flex justify-between padding">
 					<view class=" padding-xs">
 						<view class="radius">
-							<view style='font-weight: 600;font-size: 16px;margin-bottom: 5px;'>{{item.taskType}}<text v-if='item.carNo'>({{item.carNo}})</text></view>
-					  		<view style='color:#ccc;'>{{item.gmtUpdate}}</view>
-						</view>
-				  </view>
-						<view v-if="item.taskStatus == 1" class="tag-green line-green">
-							未完成
-						</view>
-						<view  v-if="item.taskStatus == 2" class="tag-gray line-gray">
-							已完成
-						</view>
-						<view  v-if="item.taskStatus == 3" class="tag-red line-red">
-							已改派
+							<view v-if="item.taskStatus != 1 " class="text-gray">
+								<view style='font-weight: 600;font-size: 16px;margin-bottom: 5px;'>{{item.taskType}}<text v-if='item.carNo'>({{item.carNo}})</text></view>
+							</view>
+							<view v-else-if="item.taskType == '出库任务'" class="text-red">
+								<view style='font-weight: 600;font-size: 16px;margin-bottom: 5px;'>{{item.taskType}}<text v-if='item.carNo'>({{item.carNo}})</text></view>
+							</view>
+							<view v-else-if="item.taskType == '入库任务'" class="text-green">
+								<view style='font-weight: 600;font-size: 16px;margin-bottom: 5px;'>{{item.taskType}}<text v-if='item.carNo'>({{item.carNo}})</text></view>
+							</view>
+							<view v-else>
+								<view style='font-weight: 600;font-size: 16px;margin-bottom: 5px;'>{{item.taskType}}<text v-if='item.carNo'>({{item.carNo}})</text></view>
+							</view>
+							<view style='color:#ccc;'>{{item.gmtUpdate}}</view>
 						</view>
+					</view>
+					<view v-if="item.taskStatus == 1" class="tag-green line-green">
+						执行中
+					</view>
+					<view  v-if="item.taskStatus == 2" class="tag-gray line-gray">
+						已完成
+					</view>
+					<view  v-if="item.taskStatus == 3" class="tag-red line-red">
+						已改派
+					</view>
 				</view>
 			</view>
 			<view v-if="item.companyId != 2" class="move" v-show='item.show==true' @click.stop="hided(item,$event)">
@@ -1010,19 +1021,19 @@
 	.tag-green{
 		border: 1px solid #39b54a;
 		padding: 4px 13px;
-		border-radius: 30px;
+		border-radius: 5px;
 		height:30px;
 	}
 	.tag-gray{
 		border: 1px solid #aaaaaa;
 		padding: 4px 13px;
-		border-radius: 30px;
+		border-radius: 5px;
 		height:30px;
 	}
 	.tag-red{
 		border: 1px solid #e54d42;
 		padding: 4px 13px;
-		border-radius: 30px;
+		border-radius: 5px;
 		height:30px;
 	}
 	

+ 1 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/dto/CollectDTO.java

@@ -47,6 +47,7 @@ public class CollectDTO extends SuperDTO {
     private Long outPerson;
     private String carNo;
     private String boxNo;
+    private String titleNo;
     //已完成数量
     private Float alreadyNum;
     private String invoiceType;

+ 8 - 8
unimall-data/src/main/resources/com/iotechn/unimall/data/mapper/TaskMapper.xml

@@ -39,14 +39,14 @@
                 t.price as outPrice,
                 s.hide,
                 t.sea_tran as seaTran,
-                ifnull(usr.buyer,b.buyer) as buyers,
-                ifnull(usr.seller,b.seller) as seller,
-                ifnull(usr.contract_no,b.contract_no) as contractNo,
-                ifnull(usr.car_no,b.car_no) as carNos,
-                ifnull(usr.net_weight,b.net_weight) as netWeights,
-                ifnull(usr.unit_price1,b.unit_price1) as unitPrice1,
+                case tr.type when 0 then usr.buyer else b.buyer end as buyers,
+                case tr.type when 0 then usr.seller else b.seller end as seller,
+                case tr.type when 0 then usr.contract_no else b.contract_no end as contractNo,
+                case tr.type when 0 then usr.car_no else b.car_no end as carNos,
+                case tr.type when 0 then usr.net_weight else b.net_weight end as netWeights,
+                case tr.type when 0 then usr.unit_price1 else b.unit_price1 end as unitPrice1,
                 s.company_id as companyId,
-                ifnull(usr.pay_money,b.money) as money,
+                case tr.type when 0 then usr.pay_money else b.money end as money,
                 tr.unit_price as unitPrice,
                 case tr.type when 0 then usr.basis else tr.basis end as basis,
                 tr.packing as packing,
@@ -56,7 +56,7 @@
                 tr.trade_contract_no as tradeContractNo,
                 ifnull(st.name,st1.name) AS storeName1,
                 tr.unloading_fee AS unloadingFee,
-                ifnull(usr.buy,b.buy) as buy,
+                case tr.type when 0 then usr.buy else b.buy end as buy,
                 IFNULL(ucom.company_name,ucom.person_name) as customer,
                 case tr.type when 0 then '销售' else '采购' end as type,
                 case tr.type when 0 then trs.title else trb.title end as title,

+ 1 - 1
unimall-data/src/main/resources/com/iotechn/unimall/data/mapper/TradeContractMapper.xml

@@ -25,7 +25,7 @@
                c.net_weight as netWeight,
                c.skin_weight as skinWeight,
                c.net_weight_rec as netWeightRec,
-               c.pound_img as poundImg,
+               c.pound_img_rec as poundImg,
                c.trade_contract_id as tradeContractId,
                c.check_type as checkType,
                CONCAT(c.deduction , '(',uta.remarks,')' )as remarks,