Administrator
2023-03-10 1c4e40639d73faae3ba87156e0e4478c50b8ee33
车辆任务增加备注和删除备注
已添加2个文件
已修改4个文件
204 ■■■■ 文件已修改
JavaSource/com/mandi/fendan/controller/Fd_VehicleController.java 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaSource/com/mandi/fendan/mapper/FdVehicleRemarkMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaSource/com/mandi/fendan/persist/FdVehicleRemark.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaSource/com/mandi/fendan/service/impl/ErpService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebContent/basic/js/vehicleBindMaterials.js 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebContent/basic/vehicleBindMaterials.xhtml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaSource/com/mandi/fendan/controller/Fd_VehicleController.java
@@ -1,12 +1,16 @@
package com.mandi.fendan.controller;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mandi.common.Jacksonmethod;
import com.mandi.common.RequestParam;
import com.mandi.common.SessionMethod;
import com.mandi.dao.common.ObjectResult;
import com.mandi.dao.common.PageRequest;
import com.mandi.dao.common.PageResult;
import com.mandi.fendan.mapper.FdVehicleRemarkMapper;
import com.mandi.fendan.persist.FdVehicleRemark;
import com.mandi.fendan.persist.Fd_Vehicle;
import com.mandi.fendan.service.Ifd_vehicleService;
import com.mandi.system.persist.Login;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
@@ -14,15 +18,11 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.mandi.common.Jacksonmethod;
import com.mandi.common.RequestParam;
import com.mandi.common.SessionMethod;
import com.mandi.dao.common.ObjectResult;
import com.mandi.dao.common.PageRequest;
import com.mandi.dao.common.PageResult;
import com.mandi.fendan.persist.Fd_Vehicle;
import com.mandi.fendan.service.Ifd_vehicleService;
import com.mandi.system.persist.Login;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
@Controller("fd_vehicle_con")
@@ -31,6 +31,51 @@
    private Logger log=Logger.getLogger(Fd_VehicleController.class);
    @Resource
    private Ifd_vehicleService ivs;
    @Resource
    private FdVehicleRemarkMapper fdVehicleRemarkMapper;
    @RequestMapping(value = "/saveRemark.htm", method = {RequestMethod.POST })
    @ResponseBody
    public void saveRemark(HttpServletRequest r,HttpServletResponse re,String numberplates,String bsNo,String remark){
        FdVehicleRemark fdVehicleRemark = new FdVehicleRemark();
        fdVehicleRemark.setRemark(remark);
        fdVehicleRemark.setBusinessNO(bsNo);
        fdVehicleRemark.setVehicle(numberplates);
        ObjectResult<Boolean> orr=new ObjectResult<>();
        try {
            FdVehicleRemark fdVehicleRemarkTemp = fdVehicleRemarkMapper.selectByBusinessNo(bsNo);
            if(fdVehicleRemarkTemp!=null) {
                int i = fdVehicleRemarkMapper.update(fdVehicleRemark);
                if (i <= 0) {
                    orr.setCode(1);
                    orr.setErrmsg("添加失败,请检查数据!");
                }
            }else {
                fdVehicleRemarkMapper.insert(fdVehicleRemark);
            }
            orr.setCode(0);
            orr.setErrmsg("添加成功!");
        }catch (Exception e) {
            log.error(e.getMessage(),e);
            orr.setCode(1);
            orr.setErrmsg("添加失败,请联系管理员!");
        }
        SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false));
    }
    @RequestMapping(value = "/getDetail.htm", method = {RequestMethod.POST })
    @ResponseBody
    public void getDetail(HttpServletRequest r,HttpServletResponse re,String numberplates,String bsNo){
        ObjectResult<FdVehicleRemark> orr=new ObjectResult<>();
        try {
            FdVehicleRemark fdVehicleRemark = fdVehicleRemarkMapper.selectByBusinessNo(bsNo);
            orr.setItem(fdVehicleRemark);
        }catch (Exception e) {
            orr.setCode(1);
            orr.setErrmsg("查询失败!");
        }
        SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false));
    }
    
    @RequestMapping(value = "/saveItem.htm", method = {RequestMethod.POST })
    @ResponseBody
JavaSource/com/mandi/fendan/mapper/FdVehicleRemarkMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.mandi.fendan.mapper;
import com.mandi.fendan.persist.FdVehicleRemark;
import org.apache.ibatis.annotations.*;
public interface FdVehicleRemarkMapper {
    @Update("update FdVehicleRemark set remark=#{remark},vehicle=#{vehicle}  where businessNo =#{businessNO} ")
    int update(FdVehicleRemark FdVehicleRemark);
    @Insert("insert into FdVehicleRemark(businessNO,vehicle,remark) values(#{businessNO},#{vehicle},#{remark})")
    FdVehicleRemark insert(FdVehicleRemark FdVehicleRemark);
    @Select("select top 1 *from FdVehicleRemark where businessNo=#{businessNO} ")
    FdVehicleRemark selectByBusinessNo(String businessNO);
    @Delete("delete from FdVehicleRemark where businessNo=#{businessNo}")
    int deleteByBusinessNo(@Param("businessNo") String businessNo);
}
JavaSource/com/mandi/fendan/persist/FdVehicleRemark.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
package com.mandi.fendan.persist;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name="fd_vehicle_xstd")
public class FdVehicleRemark {
    String  businessNO;
    String vehicle;
    String remark;
    public String getBusinessNO() {
        return businessNO;
    }
    public void setBusinessNO(String businessNO) {
        this.businessNO = businessNO;
    }
    public String getVehicle() {
        return vehicle;
    }
    public void setVehicle(String vehicle) {
        this.vehicle = vehicle;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}
JavaSource/com/mandi/fendan/service/impl/ErpService.java
@@ -89,6 +89,8 @@
    @Resource
    private SqlSessionFactory sqlSessionFactory;
    private FdVehicleRemarkMapper fdVehicleRemarkMapper;
    @Override
    public ObjectResult<String> tzPrint(Login lg, String bssNo, String ipadd) {
        ObjectResult<String> orr = new ObjectResult<String>();
@@ -981,7 +983,8 @@
            }
        }
        // åˆ é™¤è½¦è¾†åˆ†å•çš„备注remark
        fdVehicleRemarkMapper.deleteByBusinessNo(bsNo);
        or.setCode(0);
        or.setItem(true);
        return or;
WebContent/basic/js/vehicleBindMaterials.js
@@ -14,7 +14,8 @@
window.I = {
    id: $('#_id').val(),
    bsNo: $('#_bsNo').val(),
    printBtn: $('#printBtn')
    printBtn: $('#printBtn'),
    detailModal:  $("#modal"),
var ViewModel = function() {
@@ -24,9 +25,13 @@
    self.totalJZ = ko.observable(0);
    self.vehicleLoadweight = ko.observable(0);
    self.overWeight = ko.observable(0);
    self.remark = ko.observable('');
    self.isAdmin = ko.observable(typeof(parent.G) != 'undefined' ? parent.G.isAdmin : false);
    self.del = function(item) {
        delConfirm(item);
    }
    self.addRemark = function(item) {
       I.detailModal.modal('show');
    }
}
@@ -45,6 +50,35 @@
        e.preventDefault();
        newTab(I.numberplates);
    });
    $("#confirmBtn").click(function (e) {
        e.preventDefault();
        saveRemark();
    })
    $("#clearSortBtn").click(function (e){
        e.preventDefault();
        I.detailModal.modal('hide');
    })
    getRemarkDetail();
}
function saveRemark() {
    $.post("/vehicle/saveRemark.htm", {numberplates: I.numberplates, bsNo: I.bsNo, remark: vm.remark()},
        function (data, textStatus, jqXHR) {
            if(data.code == 0) {
                parent.showErrmsg('保存成功!');
            }else {
                swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'});
            }
        });
}
function getRemarkDetail() {
    $.post("/vehicle/getDetail.htm", {numberplates: I.numberplates, bsNo: I.bsNo},
        function (data, textStatus, jqXHR) {
            if(data.code == 0) {
                if(data.item) vm.remark(data.item.remark);
            }else {
                swal({title:'',text:data.errmsg,type:'error',confirmButtonText:'确定'});
            }
        });
}
function getVehicleDetails(bsNo) {
@@ -120,7 +154,7 @@
function autoHeight() {
    $('.page-content').css('min-height', $(parent.window).height() - 159);
    $('.table-responsive').css('height', $(parent.window).height() - 159);
    $('.table-responsive').css('height', $(parent.window).height() - 239);
}
function delConfirm(item) {
WebContent/basic/vehicleBindMaterials.xhtml
@@ -69,10 +69,13 @@
                    æ–°è¿è¾“公司
                </button>
            </div> -->
            <div class="col-xs-11">
            <div class="col-xs-10">
                <h3 style="margin: 0"><span data-bind="text: decodeURI('#{param.numberplates}')"></span>的已配车物资,总数量:<span data-bind="text: list().length"></span>,总毛重:<span data-bind="text: totalMZ"></span>,总净重:<span data-bind="text: totalJZ"></span>,载重:<span data-bind="text: vehicleLoadweight"></span>,超重:<span data-bind="text: (totalMZ() - vehicleLoadweight()) > 0 ? (totalMZ() - vehicleLoadweight()) : 0"></span>。</h3>
            </div>
            <div class="col-xs-1" style="text-align: right;">
            <div class="col-xs-2" style="text-align: right;">
                <button class="btn btn-sm btn-info" type="button" id="remark" data-bind="click:addRemark">
                    å¤‡æ³¨
                </button>
                <button class="btn btn-sm btn-info" type="button" id="printBtn">
                    <i class="ace-icon fa fa-print bigger-110"></i>
                    æ‰“印
@@ -135,6 +138,27 @@
                    </tbody>
                </table>
            </div>
            <div class="col-xs-12" style="margin-top: 2px;">
               å¤‡æ³¨ï¼š <div data-bind="text: remark"></div>
            </div>
        </div>
        <div class="modal fade" id="modal">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title">添加备注</h4>
                    </div>
                    <div class="modal-body" style="overflow: hidden">
                       å¤‡æ³¨ï¼š<textarea style="width:100%; resize:none;" rows="8" data-bind="value: remark"></textarea>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default btn-sm" ddata-dismiss="modal" id="clearSortBtn">取消</button>
                        <button type="button" class="btn btn-primary btn-sm" data-dismiss="modal" id="confirmBtn" >确定</button>
                    </div>
                </div>
            </div>
        </div>
        <div id="dialog-confirm" class="hide">
            <div class="alert alert-info bigger-110" id="modalContent">
@@ -142,7 +166,7 @@
        </div>
    </ui:define>
    <ui:define name="myscript">
        <script src="js/vehicleBindMaterials.js?v=#{sessionScope.login_page_vesion}"></script>
        <script src="js/vehicleBindMaterials.js?v=11222222321"></script>
    </ui:define>
</ui:composition>
</html>